| icAction | input | character | SAVE SAVEDRAFT DRAFT VALIDATE |
| ilReturnDataset | input | logical | Indication whether the logic should return the official dataset of the object that has just been created/modified. |
| ilPartialUpdate | input | logical | Indication whether the input dataset is a full object or only a partial one. |
| icPartialUpdateExceptionList | input | character | Comma separated list with fields that need to be skipped in the test logic for partial update. Fields in the list are specified as t<table>.<field>. |
| opPrimaryKey | output | longchar | |
| opRowid | output | longchar | |
| oiDraftInstance | output | integer | |
| ocPrimaryKeyName | output | character | The name of the field(s) in the primary key of the object. Normally this is the name of the object ID of the main table. (like creditor_ID) |
| ozObjectRepresentation | output | dataset-handle | The dataset containing the official representation of the object dataset. It should always be passed by-reference, meaning, the dataset handle should be created before the call. |
| oiReturnStatus | output | integer | Return status of the method. |
/* ================================================================================================== */
/* As this class has got a dataset in the class tables but CB does not provide the option to indicate */
/* in this case which table is the primary and as such we cannot return a dataset for this method by */
/* using the default mechanism in the ancestor-class. */
/* Therefore we define a local handle to the dataset in this class, fill it in the processing and */
/* then assign the the inheritted one after the ancestor-code again */
/* ================================================================================================== */
assign vlReturnCIInstanceDataCIJE = ilReturnDataset
vhBCInvoiceInstanceDataCIJE = ?
ilReturnDataset = false.
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98.
/* ================== */
/* Call the API */
/* ================== */
<M-29 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 opPrimaryKey (ocLstPrimKey),
output vcDummy (ocLstReturn),
output opRowid (ocLstRowid),
output viFcReturnSuper (oiReturnStatus)) in BCInvoiceJournalEntry>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end. /* if viFcReturnSuper <> 0 */
/* ================================================================================================================================== */
/* vhBCInvoiceInstanceDatafill is filled in the ancestor-code when requested and now we use it to assign the inheritted output param */
/* ================================================================================================================================== */
if vlReturnCIInstanceDataCIJE = true and
valid-handle (vhBCInvoiceInstanceDataCIJE)
then do :
/* Create a new dataset like the class-dataset but with no data in it: the output dataset and the input dataset of this method needs to have the same structure as class-dataset */
ozObjectRepresentation:create-like(dataset BCInvoiceJournalEntryO:handle).
/* Copy the content of the CInvoice-instance (stored in vhBCInvoiceInstanceDataCIJE) into the new dataset vhBCInvoiceJournalEntryDSetCIJE that is defined like the class-dataset: state the table-names as they are different in the two datasets */
/* So the output dataset will have the same structure as the class dataset although only the pure invoice data will be filled - and the posting-data will be empty */
ozObjectRepresentation:copy-dataset(vhBCInvoiceInstanceDataCIJE, /* handle to the source DATASET from which to copy */
true, /* Append-mode */
false, /* Replace-mode */
true, /* Loose-copy-mode; it relaxes the requirement that the metaschema for the source and target temp-tables be the same */
"tApiCInvoiceCIJE,tCInvoice,tApiCInvoiceBankCIJE,tCInvoiceBank,tApiCInvoiceBankPayCodeCIJE,tCInvoiceBankPayCode,tApiCInvoiceMovementCIJE,tCInvoiceMovement,tApiCInvoicePOCIJE,tCInvoicePO,tApiCInvoicePostingCIJE,tCInvoicePosting,tApiCInvoiceStageCIJE,tCInvoiceStage,tApiCInvoiceVatCIJE,tCInvoiceVat,tApiCInvoiceWHTCIJE,tCInvoiceWHT":U, /* pairs-list; comma-separated list of the target and source temp-table pairs to be copied */
false, /* Current-only: copy only the current record of every table? */
"Out":U). /* Name-prefix: optional character expression used as the prefix for naming the target ProDataSet */
/* Delete the object with the dataset of BCInvoice (vhBCInvoiceInstanceDataCIJE) as we have copied it already and thus no longer need it */
delete object vhBCInvoiceInstanceDataCIJE.
end. /* if valid-handle (vhBCInvoiceInstanceData) */
/* ================== */
/* Exception handling */
/* ================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.