| icDomainCode | input | character | DomainCode: Mandatory. This should be the current domain |
| icJournalCode | input | character | JornalCode: Mandatory. The type of this journal should be Periodic-costing and it should be in a management or official layer |
| iiPostingYear | input | integer | PostingYear: Mandatory. accounting-year format 9999 |
| iiPostingPeriod | input | integer | PostingPeriod: Mandatory. accounting-period format 99 |
| ilOnlyReverseUnreversedOnes | input | logical | OnlyReverseUnreversedOnes: Pass true in case you only want to reverse postings that have not yet been reversed or that are no reversals of other postings. Pass false in case you just want to reverse all postings matching the filter regardless their reversal-properties |
| ilReversalByCorrection | input | logical | ReversalByCorrection; Pass true in case debit of the reversal posting should be the credit of the reversed posting (and vice versa) Pass true in case debit and credit of the reversal posting should be the same as the debit and credit of the reversed posting but multiplied by -1 |
| tApiPeriodicCostingPostings | output | temp-table | Output temp-table holding the main references on the postings that are reversed by this method. |
| oiReturnStatus | output | integer | Return status of the method. |
/* =============================== */
/* Exception handling - main block */
/* Empty output table */
/* =============================== */
empty temp-table tApiPeriodicCostingPostings.
MAINPCREVERSALBLOCK: DO :
/* ================================================================ */
/* Replace unknown values in the input parameters and then validate */
/* the input as stated in the descriptions of the parameters itself */
/* ================================================================ */
if icDomainCode = "":U or
icDomainCode = ? or
icJournalCode = "":U or
icJournalCode = ? or
iiPostingYear = 0 or
iiPostingYear = ? or
iiPostingPeriod = 0 or
iiPostingPeriod = ?
then do :
assign vcMessage = trim(substitute(#T-48'The domain (&1), daybook (&2), year (&3) and period (&4) are all mandatory parameters for the API method.':255(617355577)T-48#,icDomainCode,icJournalCode,iiPostingYear,iiPostingPeriod))
oiReturnStatus = -3.
<M-23 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-390249':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave MAINPCREVERSALBLOCK.
end. /* if icCompanyCode = "":U or */
if ilOnlyReverseUnreversedOnes = ? or
ilReversalByCorrection = ?
then do :
assign vcMessage = trim(substitute(#T-45'The indication if reversed-postings should be handled or not (&1) and the indication if the reversal should be a correction or not (&2) are mandatory parameters for the API method.':255(733748697)T-45#,ilOnlyReverseUnreversedOnes, ilReversalByCorrection))
oiReturnStatus = -3.
<M-30 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-839927':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave MAINPCREVERSALBLOCK.
end. /* if ilOnlyReverseUnreversedOnes = ? or */
if icDomainCode <> vcDomainCode
then do :
assign vcMessage = trim(substitute(#T-49'The domain (&1) passed as input to API method must be the current domain (&2).':255(13179054)T-49#,icDomainCode,vcDomainCode))
oiReturnStatus = -3.
<M-16 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-913173':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave MAINPCREVERSALBLOCK.
end. /* if icDomainCode <> vcDomainCode */
assign vcMessage = "":U.
<Q-15 run JournalByJournalCodeWithLayer (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input icJournalCode, (JournalCode)
output dataset tqJournalByJournalCodeWithLayer) in BJournal >
Find first tqJournalByJournalCodeWithLayer where
tqJournalByJournalCodeWithLayer.tcJournalCode = icJournalCode
no-lock no-error.
if not available tqJournalByJournalCodeWithLayer
then assign vcMessage = trim(substitute(#T-69'The daybook (&1) passed as input to the API method cannot be found.':255(591295504)T-69#,icJournalCode)).
if vcMessage = "":U and
available tqJournalByJournalCodeWithLayer and
tqJournalByJournalCodeWithLayer.tlJournalIsActive <> true
then assign vcMessage = trim(substitute(#T-55'The daybook (&1) passed as input to the API method is not active.':255(332075615)T-55#,icJournalCode)).
if vcMessage = "":U and
available tqJournalByJournalCodeWithLayer and
tqJournalByJournalCodeWithLayer.tcJournalTypeCode <> {&JOURNALTYPE-PERIODICCOSTING}
then assign vcMessage = trim(substitute(#T-39'The daybook (&1) passed as input to the API method has daybook type &2. The daybook type must be &3.':255(227658115)T-39#,icJournalCode,tqJournalByJournalCodeWithLayer.tcJournalTypeCode,{&JOURNALTYPE-PERIODICCOSTING-TR})).
if vcMessage = "":U and
available tqJournalByJournalCodeWithLayer and
tqJournalByJournalCodeWithLayer.tcLayerTypeCode <> {&LAYERTYPECODE-OFFICIAL} and
tqJournalByJournalCodeWithLayer.tcLayerTypeCode <> {&LAYERTYPECODE-MANAGEMENT}
then assign vcMessage = trim(substitute(#T-12'The daybook (&1) passed as input to the API method is not defined in the official or management layer.':255(413970555)T-12#,icJournalCode,tqJournalByJournalCodeWithLayer.tcLayerTypeCode,{&LAYERTYPECODE-TRANSIENT-TR})).
if vcMessage <> "":U
then do :
assign oiReturnStatus = -3.
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-465933':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave MAINPCREVERSALBLOCK.
end. /* if vcMessage <> "":U */
/* ================================================================ */
/* Run a ClearData to make sure we start from scratch */
/* ================================================================ */
<M-86 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAINPCREVERSALBLOCK.
/* ==================================================================== */
/* Load all postings we want to reverse for every entity of this domain */
/* ==================================================================== */
<Q-21 run DomainsForCompanies (all) (Read) (Cache)
(input ?, (DomainId)
input icDomainCode, (DomainCode)
input ?, (CompanyId)
output dataset tqDomainsForCompanies) in BDomain>
for each tqDomainsForCompanies where
tqDomainsForCompanies.tcDomainCode = icDomainCode
on error undo, throw:
<M-66 run MassReversePeriodicCostingPostings
(input tqDomainsForCompanies.tcCompanyCode (icCompanyCode),
input icJournalCode (icJournalCode),
input iiPostingYear (iiPostingYear),
input iiPostingPeriod (iiPostingPeriod),
input ilOnlyReverseUnreversedOnes (ilOnlyReverseUnreversedOnes),
input ilReversalByCorrection (ilReversalByCorrection),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAINPCREVERSALBLOCK.
end. /* for each tqDomainsForCompanies where */
/* =================================================================================== */
/* Before setting the new Status and IDs, we will have to store the current ID in the */
/* cross-reference field, so we can re-direct the cross company links */
/* =================================================================================== */
for each tPostingLine where
tPostingLine.CrossCompanyPostingLine_ID <> ? and
tPostingLine.CrossCompanyPostingLine_ID <> 0
on error undo, throw:
assign tPostingLine.PostingLineCrossExternRef = string(tPostingLine.PostingLine_ID).
end. /* for each tPostingLine where */
/* ================================================================================ */
/* All records of all db-instances that we now still have in our business-instance */
/* will get tc_status = N and they will get a new value for their _ID-field */
/* The result of this single call is that all these postings will just be like new */
/* ones but with the values of the existing ones and the 'loaded ones' are gone */
/* ================================================================================ */
<M-95 run SetNewStatus (output viFcReturnSuper (oiReturnStatus)) in BPosting>
/* ===================================================================================================== */
/* Start&Open BNumber (AddToTrx=false) as in a loop below we will be calling BNumber repetively and this */
/* is more performing then using vhFcComponent=?. BNumber will be closed and stopped after the loop */
/* ===================================================================================================== */
if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ?
then do :
<I-85 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BNumber"}>
end. /* if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ? */
/* ================================================================================================================================ */
/* Start a block to make sure we leave this block in case some error occurs in the loop as we then still need to Close&Stop BNumber */
/* ================================================================================================================================ */
assign viInnerBlockReturnStatus = 0.
POSTINGNUMBERBLOCK : DO :
/* ===================================================== */
/* Go through all tPostings - they are now marked as new */
/* and they are just the ones that need to be reversed */
/* ===================================================== */
for each tPosting on error undo, throw:
/* ===================================================================== */
/* Create a record in the output temp-table holding the reversed posting */
/* ===================================================================== */
create tApiPeriodicCostingPostings.
assign tApiPeriodicCostingPostings.tcCompanyCode = vcCompanyCode /* all loaded postings were in the current company so this is okay */
tApiPeriodicCostingPostings.tiPostingYear = tPosting.PostingYear
tApiPeriodicCostingPostings.tcJournalCode = tPosting.tcJournalCode
tApiPeriodicCostingPostings.tiPostingVoucher = tPosting.PostingVoucher
tApiPeriodicCostingPostings.tcPostingOriginReference = tPosting.PostingOriginReference
tApiPeriodicCostingPostings.tcPostingOriginatorReference = tPosting.PostingOriginatorReference.
/* ========================================================================== */
/* Fill in the PostingOriginatorReference - needs to be done before we get a */
/* new voucher for the posting and after the creation of the output record- , */
/* mark the posting as a reversing one and indicate the type of reversal */
/* ========================================================================== */
assign tPosting.PostingOriginatorReference = trim(string(tPosting.PostingYear)) + "/":U +
trim(string(tPosting.tcJournalCode)) + "/":U +
trim(string(tPosting.PostingVoucher,"999999999":U))
tPosting.PostingIsReversing = true
tPosting.PostingIsReversingBySign = ilReversalByCorrection.
/* ======================================================================== */
/* Get a new voucher for the posting and store it at once in PostingVoucher */
/* ======================================================================== */
assign vhFcComponent = ?.
<M-58 run GetNumber
(input tPosting.Company_ID (iiCompanyId),
input tPosting.PostingYear (iiNumbrYear),
input tPosting.tcJournalCode (icNumbrType),
output tPosting.PostingVoucher (oiNumber),
input viFcCurrentInstanceId (iiInstanceId),
input vcFcComponentName (icClassName),
output viFcReturnSuper (oiReturnStatus)) in BNumber>
if viFcReturnSuper <> 0 then assign viInnerBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave POSTINGNUMBERBLOCK.
if not can-find (tCommitNumber where
tCommitNumber.tcNumberType = {&COMMITNUMBERTYPE-POSTINGVOUCHER} and
tCommitNumber.tcPostingRowID = tPosting.tc_Rowid)
then do :
create tCommitNumber.
assign tCommitNumber.tcNumberType = {&COMMITNUMBERTYPE-POSTINGVOUCHER}
tCommitNumber.tcPostingRowID = tPosting.tc_Rowid.
end.
/* ========================================================================== */
/* Reverse the amounts of posting and set the resundant ID's in the subtables */
/* ========================================================================== */
for each tPostingLine where
tPostingLine.tc_ParentRowid = tPosting.tc_Rowid
on error undo, throw:
assign tPostingLine.Posting_ID = tPosting.Posting_ID
tPostingLine.tlSkipCOAValForPeriodCosting = true.
if tPosting.PostingIsReversingBySign = true
then assign
tPostingLine.PostingLineCreditLC = - tPostingLine.PostingLineCreditLC
tPostingLine.PostingLineDebitLC = - tPostingLine.PostingLineDebitLC
tPostingLine.PostingLineCreditTC = - tPostingLine.PostingLineCreditTC
tPostingLine.PostingLineDebitTC = - tPostingLine.PostingLineDebitTC
tPostingLine.PostingLineCreditCC = - tPostingLine.PostingLineCreditCC
tPostingLine.PostingLineDebitCC = - tPostingLine.PostingLineDebitCC
tPostingLine.PostingLineCreditPC = - tPostingLine.PostingLineCreditPC
tPostingLine.PostingLineDebitPC = - tPostingLine.PostingLineDebitPC.
else assign
vdTempValue = tPostingLine.PostingLineCreditLC
tPostingLine.PostingLineCreditLC = tPostingLine.PostingLineDebitLC
tPostingLine.PostingLineDebitLC = vdTempValue
vdTempValue = tPostingLine.PostingLineCreditTC
tPostingLine.PostingLineCreditTC = tPostingLine.PostingLineDebitTC
tPostingLine.PostingLineDebitTC = vdTempValue
vdTempValue = tPostingLine.PostingLineCreditCC
tPostingLine.PostingLineCreditCC = tPostingLine.PostingLineDebitCC
tPostingLine.PostingLineDebitCC = vdTempValue
vdTempValue = tPostingLine.PostingLineCreditPC
tPostingLine.PostingLineCreditPC = tPostingLine.PostingLineDebitPC
tPostingLine.PostingLineDebitPC = vdTempValue.
for each tPostingVat where
tPostingVat.tc_ParentRowid = tPostingLine.tc_Rowid
on error undo, throw:
assign tPostingVat.Posting_ID = tPostingLine.Posting_ID
tPostingVat.PostingLine_ID = tPostingLine.PostingLine_ID.
if tPosting.PostingIsReversingBySign = true
then assign
tPostingVat.PostingVatBaseCreditLC = - tPostingVat.PostingVatBaseCreditLC
tPostingVat.PostingVatBaseDebitLC = - tPostingVat.PostingVatBaseDebitLC
tPostingVat.PostingVatBaseCreditTC = - tPostingVat.PostingVatBaseCreditTC
tPostingVat.PostingVatBaseDebitTC = - tPostingVat.PostingVatBaseDebitTC
tPostingVat.PostingVatBaseCreditCC = - tPostingVat.PostingVatBaseCreditCC
tPostingVat.PostingVatBaseDebitCC = - tPostingVat.PostingVatBaseDebitCC
tPostingVat.PostingVatTaxCreditLC = - tPostingVat.PostingVatTaxCreditLC
tPostingVat.PostingVatTaxDebitLC = - tPostingVat.PostingVatTaxDebitLC
tPostingVat.PostingVatTaxCreditTC = - tPostingVat.PostingVatTaxCreditTC
tPostingVat.PostingVatTaxDebitTC = - tPostingVat.PostingVatTaxDebitTC
tPostingVat.PostingVatTaxCreditCC = - tPostingVat.PostingVatTaxCreditCC
tPostingVat.PostingVatTaxDebitCC = - tPostingVat.PostingVatTaxDebitCC.
else assign
vdTempValue = tPostingVat.PostingVatBaseCreditLC
tPostingVat.PostingVatBaseCreditLC = tPostingVat.PostingVatBaseDebitLC
tPostingVat.PostingVatBaseDebitLC = vdTempValue
vdTempValue = tPostingVat.PostingVatBaseCreditTC
tPostingVat.PostingVatBaseCreditTC = tPostingVat.PostingVatBaseDebitTC
tPostingVat.PostingVatBaseDebitTC = vdTempValue
vdTempValue = tPostingVat.PostingVatBaseCreditCC
tPostingVat.PostingVatBaseCreditCC = tPostingVat.PostingVatBaseDebitCC
tPostingVat.PostingVatBaseDebitCC = vdTempValue
vdTempValue = tPostingVat.PostingVatTaxCreditLC
tPostingVat.PostingVatTaxCreditLC = tPostingVat.PostingVatTaxDebitLC
tPostingVat.PostingVatTaxDebitLC = vdTempValue
vdTempValue = tPostingVat.PostingVatTaxCreditTC
tPostingVat.PostingVatTaxCreditTC = tPostingVat.PostingVatTaxDebitTC
tPostingVat.PostingVatTaxDebitTC = vdTempValue
vdTempValue = tPostingVat.PostingVatTaxCreditCC
tPostingVat.PostingVatTaxCreditCC = tPostingVat.PostingVatTaxDebitCC
tPostingVat.PostingVatTaxDebitCC = vdTempValue.
end. /* for each tPostingVat where*/
for each tPostingSaf where
tPostingSaf.tc_ParentRowid = tPostingLine.tc_Rowid
on error undo, throw:
assign tPostingSaf.PostingLine_ID = tPostingLine.PostingLine_ID
tPostingSaf.Posting_ID = tPostingLine.Posting_ID.
end. /* for each tPostingSaf where */
for each tPostingVatDelay where
tPostingVatDelay.tc_ParentRowid = tPostingLine.tc_Rowid
on error undo, throw:
assign tPostingVatDelay.Posting_ID = tPostingLine.Posting_ID
tPostingVatDelay.PostingLine_ID = tPostingLine.PostingLine_ID.
if tPosting.PostingIsReversingBySign = true
then assign
tPostingVatDelay.PostingVatDelayBaseCredLC = - tPostingVatDelay.PostingVatDelayBaseCredLC
tPostingVatDelay.PostingVatDelayBaseDebLC = - tPostingVatDelay.PostingVatDelayBaseDebLC
tPostingVatDelay.PostingVatDelayBaseCredTC = - tPostingVatDelay.PostingVatDelayBaseCredTC
tPostingVatDelay.PostingVatDelayBaseDebTC = - tPostingVatDelay.PostingVatDelayBaseDebTC
tPostingVatDelay.PostingVatDelayBaseCredCC = - tPostingVatDelay.PostingVatDelayBaseCredCC
tPostingVatDelay.PostingVatDelayBaseDebCC = - tPostingVatDelay.PostingVatDelayBaseDebCC.
else assign
vdTempValue = tPostingVatDelay.PostingVatDelayBaseCredLC
tPostingVatDelay.PostingVatDelayBaseCredLC = tPostingVatDelay.PostingVatDelayBaseDebLC
tPostingVatDelay.PostingVatDelayBaseDebLC = vdTempValue
vdTempValue = tPostingVatDelay.PostingVatDelayBaseCredTC
tPostingVatDelay.PostingVatDelayBaseCredTC = tPostingVatDelay.PostingVatDelayBaseDebTC
tPostingVatDelay.PostingVatDelayBaseDebTC = vdTempValue
vdTempValue = tPostingVatDelay.PostingVatDelayBaseCredCC
tPostingVatDelay.PostingVatDelayBaseCredCC = tPostingVatDelay.PostingVatDelayBaseDebCC
tPostingVatDelay.PostingVatDelayBaseDebCC = vdTempValue.
end. /* for each tPostingVatDelay where*/
end. /* for each tPostingLine where */
end. /* For each tPosting */
END. /* POSTINGNUMBERBLOCK */
/* ======================================================================================================== */
/* Change the links of a cross-company posting for the reversals */
/* This needs to be a new loop because the tPostingLine.Posting_ID needs to be filled for all records first */
/* ======================================================================================================== */
for each tPostingLine where
tPostingLine.CrossCompanyPostingLine_ID <> 0 and
tPostingLine.CrossCompanyPostingLine_ID <> ? and
tPostingLine.PostingLineCrossExternRef <> ? and
tPostingLine.PostingLineCrossExternRef <> ""
on error undo, throw:
assign viCrossPostingLineId = int(tPostingLine.PostingLineCrossExternRef) no-error.
find bPostingLine where
bPostingLine.CrossCompanyPostingLine_ID = viCrossPostingLineId
no-error.
if available bPostingLine
then assign bPostingLine.CrossCompanyPosting_ID = tPostingLine.Posting_ID
bPostingLine.CrossCompanyPostingLine_ID = tPostingLine.PostingLine_ID
tPostingLine.CrossCompanyPosting_ID = bPostingLine.Posting_ID
tPostingLine.CrossCompanyPostingLine_ID = bPostingLine.PostingLine_ID
bPostingLine.PostingLineCrossExternRef = ""
tPostingLine.PostingLineCrossExternRef = "".
end. /* if tPostingLine.CrossCompanyPostingLine_ID <> 0 and */
/* ========================================================================================== */
/* Close&Stop BNumber that is started with a different transaction before the previous loop */
/* ========================================================================================== */
if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ?
then do :
<I-94 {bFcCloseAndStopInstance
&CLASS = "BNumber"}>
end. /* if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ? */
/* ============================================== */
/* Capture errors from within the previous block */
/* ============================================== */
if viInnerBlockReturnStatus <> 0
then assign oiReturnStatus = viInnerBlockReturnStatus.
if viInnerBlockReturnStatus < 0
then Leave MAINPCREVERSALBLOCK.
/* ================================================================ */
/* Call ValidateBC, AdditionalUpdates and DataSave. */
/* ================================================================ */
<M-22 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAINPCREVERSALBLOCK.
<M-13 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAINPCREVERSALBLOCK.
<M-29 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave MAINPCREVERSALBLOCK.
/* =============================== */
/* Exception handling - main block */
/* =============================== */
END. /* MAINPCREVERSALBLOCK */
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 = "BPosting".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiMassReversePeriodicCostingPostingsByDomain".
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/bposting.apimassreverseperiodiccostingpostingsbydomain.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icDomainCode = <parameter value>
vhParameter::icJournalCode = <parameter value>
vhParameter::iiPostingYear = <parameter value>
vhParameter::iiPostingPeriod = <parameter value>
vhParameter::ilOnlyReverseUnreversedOnes = <parameter value>
vhParameter::ilReversalByCorrection = <parameter value>.
/* 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.