t_sApiCInvoiceCIJE | input | temp-table | Input temp-table holding the creditor invoice data to be created, updated or deleted. |
t_sApiCInvoiceBankCIJE | input | temp-table | Input temp-table holding the bank reocrds of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoiceBankPayCodeCIJE | input | temp-table | Input temp-table holding the bank payment code records of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoiceMovementCIJE | input | temp-table | Input temp-table holding the movement records of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoicePOCIJE | input | temp-table | Input temp-table holding the purchase order records of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoicePostingCIJE | input | temp-table | Input temp-table holding the posting records of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoiceVatCIJE | input | temp-table | Input temp-table holding the vat records of the creditor invoice to be created, updated or deleted. |
t_sApiCInvoiceStageCIJE | input | temp-table | Input temp-table holding the stage records of the creditor invoice to be created, updated or deleted. |
t_sApiPostingCIJE | input | temp-table | Input temp-table holding the posting data to be created, updated or deleted. |
t_sApiPostingLineCIJE | input | temp-table | Input temp-table holding the posting line data to be created, updated or deleted. |
t_sApiPostingSafCIJE | input | temp-table | Input temp-table holding the posting saf data to be created, updated or deleted. |
t_sApiPostingVatCIJE | input | temp-table | Input temp-table holding the posting vat data to be created, updated or deleted. |
t_sApiPostingVatDelayCIJE | input | temp-table | Input temp-table holding the posting vat delay data to be created, updated or deleted. |
icAction | input | character | This parameter defines what should happen with the input data : -SAVE: Save the data if there were no errors, -SAVESTORE : Save the data if there were no errors. If there were errors, save as draft. -STORE : Save the data as draft -VALIDATE : Validate the input data, but do no save the data. |
ocLstPrimKey | output | character | Char4 separated list with the primary keys of the newly created main-table records. The fields of a primkey are separated with Char2. E.g. 1<Char2>2002<Char2>100<Char4>1<Char2>2002<Char2>101 |
ocLstReturn | output | character | Char4 separated list with the return-status of the newly created main-table records. Zero means no errors occured. E.g. 0<Char4>-1<Char4>-504<Char4>1<Char4>0 |
ocLstRowid | output | character | Char4 separated list with the temporarely rowids (negative for new ones) of the newly created main-table records. . E.g. -1<Char2>aox00098001<Char2>-26 |
oiReturnStatus | output | integer | Return status of the method. |
/* ===================================*/ /* Call the new version of the method */ /* ===================================*/ empty temp-table t_sApiCInvoiceWHTCIJE. <M-54 run ApiStdMaintainTTV01 (input t_sApiCInvoiceCIJE (t_sApiCInvoiceCIJE), input t_sApiCInvoiceBankCIJE (t_sApiCInvoiceBankCIJE), input t_sApiCInvoiceBankPayCodeCIJE (t_sApiCInvoiceBankPayCodeCIJE), input t_sApiCInvoiceMovementCIJE (t_sApiCInvoiceMovementCIJE), input t_sApiCInvoicePOCIJE (t_sApiCInvoicePOCIJE), input t_sApiCInvoicePostingCIJE (t_sApiCInvoicePostingCIJE), input t_sApiCInvoiceVatCIJE (t_sApiCInvoiceVatCIJE), input t_sApiCInvoiceStageCIJE (t_sApiCInvoiceStageCIJE), input t_sApiCInvoiceWHTCIJE (t_sApiCInvoiceWHTCIJE), input t_sApiPostingCIJE (t_sApiPostingCIJE), input t_sApiPostingLineCIJE (t_sApiPostingLineCIJE), input t_sApiPostingSafCIJE (t_sApiPostingSafCIJE), input t_sApiPostingVatCIJE (t_sApiPostingVatCIJE), input t_sApiPostingVatDelayCIJE (t_sApiPostingVatDelayCIJE), input icAction (icAction), output ocLstPrimKey (ocLstPrimKey), output ocLstReturn (ocLstReturn), output ocLstRowid (ocLstRowid), output viFcReturnSuper (oiReturnStatus)) in BCInvoiceJournalEntry> if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then return.
define temp-table ttContext no-undo field propertyQualifier as character field propertyName as character field propertyValue as character index entityContext is primary unique propertyQualifier propertyName index propertyQualifier propertyQualifier. define dataset dsContext for ttContext. define variable vhContextDS as handle no-undo. define variable vhExceptionDS as handle no-undo. define variable vhServer as handle no-undo. define variable vhInputDS as handle no-undo. define variable vhInputOutputDS as handle no-undo. define variable vhOutputDS as handle no-undo. define variable vhParameter as handle no-undo. /* Create context */ create ttContext. assign ttContext.propertyName = "programName" ttContext.propertyValue = "BCInvoiceJournalEntry". create ttContext. assign ttContext.propertyName = "methodName" ttContext.propertyValue = "ApiStdMaintainTT". create ttContext. assign ttContext.propertyName = "applicationId" ttContext.propertyValue = "fin". create ttContext. assign ttContext.propertyName = "entity" ttContext.propertyValue = "1000". create ttContext. assign ttContext.propertyName = "userName" ttContext.propertyValue = "mfg". create ttContext. assign ttContext.propertyName = "password" ttContext.propertyValue = "". /* Create input dataset */ create dataset vhInputDS. vhInputDS:read-xmlschema("file", "xml/bcinvoicejournalentry.apistdmaintaintt.i.xsd", ?). vhParameter = vhInputDS:get-buffer-handle("tParameterI"). vhParameter:buffer-create(). assign vhParameter::icAction = <parameter value>. vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceBankCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceBankPayCodeCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceMovementCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoicePOCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoicePostingCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceVatCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiCInvoiceStageCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiPostingCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiPostingLineCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiPostingSafCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiPostingVatCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... vhParameter = vhInputDS:get-buffer-handle("tApiPostingVatDelayCIJE"). vhParameter:buffer-create(). assign vhParameter::<field-name-1> = <field-value-1> vhParameter::<field-name-2> = <field-value-2> ... /* Connect the AppServer */ create server vhServer. vhServer:connect("-URL <appserver-url>"). if not vhServer:connected() then do: message "Could not connect AppServer" view-as alert-box error title "Error". return. end. /* Run */ assign vhContextDS = dataset dsContext:handle. run program/rpcrequestservice.p on vhServer (input-output dataset-handle vhContextDS by-reference, output dataset-handle vhExceptionDS, input dataset-handle vhInputDS by-reference, input-output dataset-handle vhInputOutputDS by-reference, output dataset-handle vhOutputDS). /* Handle output however you want, in this example, we dump it to xml */ if valid-handle(vhExceptionDS) then vhExceptionDS:write-xml("file", "Exceptions.xml", true). if valid-handle(vhOutputDS) then vhOutputDS:write-xml("file", "Output.xml", true). /* Cleanup */ vhServer:disconnect(). assign vhServer = ?. if valid-handle(vhInputDS) then delete object vhInputDS. if valid-handle(vhOutputDS) then delete object vhOutputDS. if valid-handle(vhExceptionDS) then delete object vhExceptionDS.