project QadFinancials > class BPosting > method SetPostingOriginAddressCode
Description
Method that allows to set the PostingOriginAddressCode for a posting that is already loaded in the instance
Parameters
icPostingTcRowID | input | character | |
iiPostingID | input | integer | |
icPostingOriginAddressCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bposting.p)
/* Replace unknown values - leave when there is no input */
if iiPostingID = ? then assign iiPostingID = 0.
if icPostingTcRowID = ? then assign icPostingTcRowID = "":U.
if icPostingTcRowID = "":U and
iiPostingID = 0
then return.
/* Find the Posting in the instance */
if icPostingTcRowID <> "":U
then find tPosting where
tPosting.tc_Rowid = icPostingTcRowID and
tPosting.tc_Status <> "D":U
no-error.
else find tPosting where
tPosting.Posting_ID = iiPostingID and
tPosting.tc_Status <> "D":U
no-error.
if not available tPosting
then do:
assign vcMessage = trim(substitute(#T-2'Internal error: unable to find the posting based on the Row ID (&1) or the Posting ID (&2).':255(733740871)T-2#, icPostingTcRowID, string(iiPostingID)))
oiReturnStatus = -3.
<M-1 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-9822':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
return.
end. /* if not available tPosting */
/* update the value */
if tPosting.PostingOriginAddressCode <> icPostingOriginAddressCode
then assign tPosting.PostingOriginAddressCode = icPostingOriginAddressCode
tPosting.tc_Status = if tPosting.tc_Status = "":U
then "C":U
else tPosting.tc_Status.