project QadFinancials > class BAPMatching > method ValidateComponentPostAPMLn2
validation procedure
Parameters
blStartAPMatchingLnByStatusPvod | input-output | logical | StartAPMatchingLnByStatusPvod |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bapmatching.p)
/* ==================================================================================== */
/* Note: this method is executed for every new/changed Lines of the non-deleted Headers */
/* ==================================================================================== */
/* ========================== */
/* Set default return-status */
/* ========================== */
assign oiReturnStatus = -98.
/* ============================= */
/* Check for record-availability */
/* ============================= */
if not available t_sAPMatchingLn or
not available t_sAPMatching
then do :
assign vcMsgAPMatching = trim(substitute(#T-85'Internal error: no AP matching or AP matching line record is available.':252(56454)T-85#)).
oiReturnStatus = -1.
<M-64 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6735':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Return.
end. /* if not available t_sAPMatchingLn */
/* ================== */
/* Get initial values */
/* ================== */
if can-do("C,D":U, t_sAPMatchingLn.tc_Status)
then do:
find t_iAPMatchingLn where
t_iAPMatchingLn.tc_Rowid = t_sAPMatchingLn.tc_Rowid
no-error.
if not available t_iAPMatchingLn
then do:
assign vcMsgAPMatching = trim(substitute(#T-86'Internal Error: Initial values for APMatchingLn record with row ID &1 not found.':250(56081)T-86#,t_sAPmatchingLn.tc_Rowid))
oiReturnStatus = -3.
<M-68 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 1 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6738':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Return.
end. /* if not available t_iAPMatchingLn */
end. /* if can-do */
/* ==================================================================================== */
/* A non-log-charge Line should finished when matched quantity equals received quantity */
/* ==================================================================================== */
if t_sAPMatching.tc_Status <> "D":U and
(t_sAPMatchingLn.tc_Status = "C":U or
t_sAPMatchingLn.tc_Status = "N":U) and
t_sAPMatchingLn.APMatchingLnPvodIsLgCharge <> true and
t_sAPMatchingLn.APMatchingLnIsPvodFinished <> true and
t_sAPMatchingLn.APMatchingLnMatchQty = t_sAPMatchingLn.APMatchingLnPvodOpenQty
then do:
assign vcMsgAPMatching = trim(#T-107'A matching line has to be finished when matched quantity equals opened quantity.':250(65487)T-107#)
viLocalReturnStatus = -1.
<M-106 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.APMatchingLnIsPvodFinished':U (icFieldName),
input string(t_sAPMatchingLn.APMatchingLnIsPvodFinished) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-7089':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if t_sAPMatching.tc_Status <> "D":U and */
/* ================================================================================ */
/* A Line should either be finished, either the Allocated Amt+Qty filled */
/* ================================================================================ */
if t_sAPMatching.tc_Status <> "D":U and
(t_sAPMatchingLn.tc_Status = "C":U or
t_sAPMatchingLn.tc_Status = "N":U) and
t_sAPMatchingLn.APMatchingLnIsPvodFinished <> true and
(t_sAPMatchingLn.APMatchingLnMatchQty = 0 or
t_sAPMatchingLn.APMatchingLnMatchQty = ?) and
(t_sAPMatchingLn.APMatchingLnMatchAmtTC = 0 or
t_sAPMatchingLn.APMatchingLnMatchAmtTC = ?)
then do:
assign vcMsgAPMatching = trim(#T-92'A matching line should have the option to finish the pending invoice enabled, to the matched amount and matched quantity filled.':250(56095)t-92#) + chr(10) +
trim(substitute(#T-93'Finish the pending invoice: &1.':253(56092)T-93#,string(t_sAPMatchingLn.APMatchingLnIsPvodFinished))) + chr(10) +
trim(substitute(#T-94'Matched quantity: &1.':253(56093)T-94#,string(t_sAPMatchingLn.APMatchingLnMatchQty))) + chr(10) +
trim(substitute(#T-95'Matched amount: &1.':253(56094)T-95#,string(t_sAPMatchingLn.APMatchingLnMatchAmtTC)))
viLocalReturnStatus = -1.
<M-66 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.APMatchingLnIsPvodFinished':U (icFieldName),
input string(t_sAPMatchingLn.APMatchingLnIsPvodFinished) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6737':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if (t_sAPMatching.tc_Status = "C":U or */
/* ================================================================================================================================== */
/* Raise a Warning: A single Pvod-record can only be used in a single APMatchingLn record where APMatching.APMatchingStatus = Initial */
/* (take the domain into account when looking for a certain Pvod in the APMatchignLn) (check the db and the instance data) */
/* ================================================================================================================================== */
if t_sAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-INITIAL} and
t_sAPMatching.tc_Status <> "D":U
then do :
/* Check the instance */
for first btsAPMatchingLn where
btsAPMatchingLn.tc_status <> "D":U and
btsAPMatchingLn.PvoDomain = t_sAPMatchingLn.PvoDomain and
btsAPMatchingLn.PvoID = t_sAPMatchingLn.PvoID and
btsAPMatchingLn.PvodLineID = t_sAPMatchingLn.PvodLineID and
btsAPMatchingLn.tc_Rowid <> t_sAPMatchingLn.tc_Rowid
no-lock,
first btsAPMatching where
btsAPMatching.tc_Status <> "D":U and
btsAPMatching.tc_Rowid = btsAPMatchingLn.tc_ParentRowid and
btsAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-INITIAL}
no-lock :
assign vcMsgAPMatching = trim(substitute(#T-96'Warning: You used the pending invoice detail (&1/&2/&3) on this initial matching although it is already used on another initial matching in this transaction. Are you sure you want to continue?':254(56402)T-96#,t_sAPMatchingLn.PvoDomain,string(t_sAPMatchingLn.PvoID),string(t_sAPMatchingLn.PvodLineID))) + chr(10) +
trim(substitute(#T-97'First initial matching on this pending invoice detail: &1 / &2 / &3. ID: &4.':253(56400)T-97#,string(t_sAPMatching.tiCInvoicePostingYear),string(t_sAPMatching.tcCInvoiceJournalCode),string(t_sAPMatching.tiCInvoiceVoucher),string(t_sAPMatching.CInvoice_ID))) + chr(10) +
trim(substitute(#T-98'Second initial matching on this pending invoice detail: &1 / &2 / &3. ID: &4.':253(56401)T-98#,string(btsAPMatching.tiCInvoicePostingYear),string(btsAPMatching.tcCInvoiceJournalCode),string(btsAPMatching.tiCInvoiceVoucher),string(btsAPMatching.CInvoice_ID)))
viLocalReturnStatus = (if viLocalReturnStatus >= 0 then +1 else viLocalReturnStatus).
<M-71 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6740':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* for first btsAPMatchingLn where */
/* Check the DB */
if blStartAPMatchingLnByStatusPvod = false
then do :
<Q-69 run APMatchingLnByStatusPvod
(Start) in BAPMatching >
assign blStartAPMatchingLnByStatusPvod = true.
end. /* if blStartAPMatchingLnByStatusPvod = false */
<Q-74 run APMatchingLnByStatusPvod (all) (Read) (NoCache)
(input ?, (CompanyId)
input t_sAPMatchingLn.PvoDomain, (PvoDomain)
input t_sAPMatchingLn.PvoID, (PvoID)
input t_sAPMatchingLn.PvodLineID, (PvodLineID)
input {&APMATCHINGSTATUS-INITIAL}, (APMatchingStatus)
input t_sAPMatchingLn.tc_Rowid, (SkipAPMatchingLnRowid)
output dataset tqAPMatchingLnByStatusPvod) in BAPMatching>
find first tqAPMatchingLnByStatusPvod where
tqAPMatchingLnByStatusPvod.tiCInvoice_ID <> t_sAPMatching.CInvoice_ID
no-lock no-error.
if available tqAPMatchingLnByStatusPvod
then do :
assign vcMsgAPMatching = trim(substitute(#T-99'Warning: You used the pending invoice detail (&1/&2/&3) on this initial matching although it is already used on another initial matching in the database. Are you sure you want to continue?':255(56403)T-99#,t_sAPMatchingLn.PvoDomain,string(t_sAPMatchingLn.PvoID),string(t_sAPMatchingLn.PvodLineID))) + chr(10) +
trim(substitute(#T-100'First initial matching on this pending invoice detail: &1 / &2 / &3. ID: &4.':253(56400)T-100#,string(t_sAPMatching.tiCInvoicePostingYear),string(t_sAPMatching.tcCInvoiceJournalCode),string(t_sAPMatching.tiCInvoiceVoucher),string(t_sAPMatching.CInvoice_ID))) + chr(10) +
trim(substitute(#T-101'Second initial matching on this pending invoice detail: &1 / &2 / &3. ID: &4.':253(56401)T-101#,string(tqAPMatchingLnByStatusPvod.tiCInvoicePostingYear),string(tqAPMatchingLnByStatusPvod.tcJournalCode),string(tqAPMatchingLnByStatusPvod.tiCInvoiceVoucher),string(tqAPMatchingLnByStatusPvod.tiCInvoice_ID)))
viLocalReturnStatus = (if viLocalReturnStatus >= 0 then +1 else viLocalReturnStatus).
<M-75 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6743':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if available tqAPMatchingLnByStatusPvod */
end. /* if t_sAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-INITIAL} */
/* ======================================================================== */
/* Raise a Warning: Different supplier of invoice and different on receipt */
/* ======================================================================== */
if t_sAPMatching.tc_Status <> "D":U and
t_sAPMatchingLn.APMatchingLnPvodSupplier <> ? and
t_sAPMatchingLn.APMatchingLnPvodSupplier <> "":U and
t_sAPMatchingLn.APMatchingLnPvodSupplier <> t_sAPMatching.tcCreditorCode and
(t_sAPMatchingLn.tc_Status = "N":U or
(t_sAPMatchingLn.tc_Status = "C":U and
t_sAPMatchingLn.APMatchingLnPvodSupplier <> t_iAPMatchingLn.APMatchingLnPvodSupplier))
then do:
assign vcMsgAPMatching = trim(substitute(#T-79'Invoice supplier (&1) and receipt supplier (&2) are different for order (&3)/reference (&4).':255(69273)t-79#,
t_sAPMatching.tcCreditorCode, t_sAPMatchingLn.APMatchingLnPvodSupplier, t_sAPMatchingLn.APMatchingLnPvodOrder,t_sAPMatchingLn.APMatchingLnPvodIntRef))
viLocalReturnStatus = (if viLocalReturnStatus >= 0 then 1 else viLocalReturnStatus).
<M-63 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6734':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if t_sAPMatching.tc_Status <> "D":U */
/* =============================================================== */
/* Raise a Warning: Different payment-cond of invoice and receipt */
/* ================================================================ */
if t_sAPMatching.tc_Status <> "D":U and
t_sAPMatchingLn.APMatchingLnPvodPayCond <> ? and
t_sAPMatchingLn.APMatchingLnPvodPayCond <> "":U and
t_sAPMatchingLn.APMatchingLnPvodPayCond <> t_sAPMatching.tcCInvoicePaymentConditionCode and
(t_sAPMatchingLn.tc_Status = "N":U or
(t_sAPMatchingLn.tc_Status = "C":U and
t_sAPMatchingLn.APMatchingLnPvodPayCond <> t_iAPMatchingLn.APMatchingLnPvodPayCond))
then do:
assign vcMsgAPMatching = trim(substitute(#T-109'The credit terms of the invoice (&1) and the credit terms of the receipt (&2) are different for order (&3)/reference (&4).':255(69274)t-109#,
t_sAPMatching.tcCInvoicePaymentConditionCode, t_sAPMatchingLn.APMatchingLnPvodPayCond, t_sAPMatchingLn.APMatchingLnPvodOrder,t_sAPMatchingLn.APMatchingLnPvodIntRef))
viLocalReturnStatus = (if viLocalReturnStatus >= 0 then 1 else viLocalReturnStatus).
<M-108 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-7971':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if t_sAPMatching.tc_Status <> "D":U */
/* ====================================================================================================== */
/* A single Pvod-record can only be used once in all APMatchingLn-records of a single finished APMatching */
/* record . (take the domain into account when looking for a certain Pvod in the APMatchignLn) */
/* ====================================================================================================== */
if t_sAPMatching.tc_Status <> "D":U and
t_sAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-FINISHED}
then do :
/* Check the instance */
find first btsAPMatchingLn where
btsAPMatchingLn.tc_status <> "D":U and
btsAPMatchingLn.tc_ParentRowid = t_sAPMatchingLn.tc_ParentRowid and
btsAPMatchingLn.PvoDomain = t_sAPMatchingLn.PvoDomain and
btsAPMatchingLn.PvoID = t_sAPMatchingLn.PvoID and
btsAPMatchingLn.PvodLineID = t_sAPMatchingLn.PvodLineID and
btsAPMatchingLn.tc_Rowid <> t_sAPMatchingLn.tc_Rowid
no-lock no-error.
if available btsAPMatchingLn
then do :
assign vcMsgAPMatching = trim(substitute(#T-102'A pending invoice detail (&1/&2/&3) can only be used once in a single finished matching.':254(56404)T-102#,t_sAPMatchingLn.PvoDomain,string(t_sAPMatchingLn.PvoID),string(t_sAPMatchingLn.PvodLineID))) + chr(10) +
trim(substitute(#T-103'Invoice of the Matching: &1 / &2 / &3.':253(56406)T-103#,string(t_sAPMatching.tiCInvoicePostingYear),string(t_sAPMatching.tcCInvoiceJournalCode),string(t_sAPMatching.tiCInvoiceVoucher)))
viLocalReturnStatus = -1.
<M-76 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6744':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* for first btsAPMatchingLn where */
end. /* if t_sAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-FINISHED} */
<Q-36 run PendingVoucherForDetails (all) (Read) (NoCache)
(input t_sAPMatchingLn.PvoDomain, (Domain)
input t_sAPMatchingLn.PvoID, (PvoID)
input t_sAPMatchingLn.PvodLineID, (PvodIdLine)
output dataset tqPendingVoucherForDetails) in BMfgPendingVoucher>
find first tqPendingVoucherForDetails where
tqPendingVoucherForDetails.tcpvo_domain = t_sAPMatchingLn.PvoDomain and
tqPendingVoucherForDetails.tipvo_id = t_sAPMatchingLn.PvoID and
tqPendingVoucherForDetails.tipvod_id_line = t_sAPMatchingLn.PvodLineID
no-error.
if available tqPendingVoucherForDetails and
tqPendingVoucherForDetails.tlpvo_consignment <> True
then do:
/* ================================================================================================ */
/* Error: If a first APMatchingLn and a second APMatchingLn point to the same pvo_mstr and to a */
/* different pvod_det, then they both should have the finish-pvo flag on or both have this flag off */
/* (take the domain into account when looking for a certain Pvod in the APMatchignLn) */
/* ================================================================================================ */
find first btsAPMatchingLn where
btsAPMatchingLn.tc_status <> "D":U and
btsAPMatchingLn.PvoDomain = t_sAPMatchingLn.PvoDomain and
btsAPMatchingLn.PvoID = t_sAPMatchingLn.PvoID and
btsAPMatchingLn.PvodLineID <> t_sAPMatchingLn.PvodLineID and
btsAPMatchingLn.tc_Rowid <> t_sAPMatchingLn.tc_Rowid and
btsAPMatchingLn.APMatchingLnIsPvodFinished <> t_sAPMatchingLn.APMatchingLnIsPvodFinished
no-lock no-error.
if available btsAPMatchingLn
then do :
assign vcMsgAPMatching = trim(substitute(#T-104'Two pending invoice details of the same pending invoice ((&1 / &2) were used in the same matching, but one of the matching lines has Finish Pending Invoice selected and the other does not.':254(56407)T-104#,t_sAPMatchingLn.PvoDomain,string(t_sAPMatchingLn.PvoID))) + chr(10) +
trim(substitute(#T-105'Invoice of the matching: &1 / &2 / &3. ID:&4.':253(56408)t-105#,string(t_sAPMatching.tiCInvoicePostingYear),string(t_sAPMatching.tcCInvoiceJournalCode),string(t_sAPMatching.tiCInvoiceVoucher),string(t_sAPMatching.CInvoice_ID)))
viLocalReturnStatus = -1.
<M-70 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sAPMatchingLn.PvodLineID) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-6739':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if avail btsAPMatchingLn */
end. /* if vlFcQueryRecordsAvailable = false */
if t_sAPMatchingLn.APMatchingLnPvodItemType = {&APMATCHINGLNPVODITEMTYPE-MEMO}
then do:
<Q-65 assign vlFcQueryRecordsAvailable = GLByGLType (NoCache)
(input viCompanyId, (CompanyId)
input t_sAPMatchingLn.GL_ID, (GLId)
input t_sAPMatchingLn.tcGLCode, (GLCode)
input {&GLTYPECODE-STAN}, (GLTypeCode)
input ?, (GLIsDivisionAccount)) in BGL>
if not vlFcQueryRecordsAvailable
then do:
assign vcMsgAPMatching = trim(substitute(#T-44'The selected GL (&1) should be a standard account.':100(53251)T-44#,string(t_sAPMatchingLn.tcGLCode)))
viLocalReturnStatus = -1.
<M-28 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 't_sAPMatchingLn.tcGLCode':U (icFieldName),
input t_sAPMatchingLn.tcGLCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'qadfin-923379':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if not vlFcQueryRecordsAvailable */
end. /* if */
if t_sAPMatching.APMatchingDate < t_sAPMatchingLn.ttAPMatchingLnPvodEffDate
then do:
assign vcDatetemp = <M-52 DisplayDate (input t_sAPMatching.APMatchingDate (itDate)) in BAPMatching>
vcDatetemp1 = <M-91 DisplayDate (input t_sAPMatchingLn.ttAPMatchingLnPvodEffDate (itDate)) in BAPMatching>.
assign vcMsgAPMatching = trim(substitute(#T-12'The receiver matching date (&1) is earlier than PO Receipt Effective date (&2).':150(736521337)T-12#, vcDatetemp, vcDatetemp1)).
<M-34 run SetMessage
(input vcMsgAPMatching (icMessage),
input string(t_sAPMatchingLn.ttAPMatchingLnPvodEffDate) (icArguments),
input 't_sAPMatching.APMatchingDate':U (icFieldName),
input vcDatetemp (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'qadfin-926934':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viLocalReturnStatus >= 0
then assign viLocalReturnStatus = 1.
end. /* if */
if available tqPendingVoucherForDetails and
t_sAPMatchingLn.APMatchingLnPvodIsLgCharge = false and
((tqPendingVoucherForDetails.tcpvod_last_voucher <> "":U and
tqPendingVoucherForDetails.tcpvod_last_voucher <> ?) or
(t_sAPMatchingLn.APMatchingLnIsPvodFinished = true and
t_sAPMatchingLn.APMatchingLnPvodOpenQty <> (tqPendingVoucherForDetails.tdpvod_trans_qty - tqPendingVoucherForDetails.tdpvod_vouchered_qty)))
then do:
assign vcMsgAPMatching = trim(substitute(#T-37'You used pending invoice detail (&1/&2/&3) on this matching for order (&4) / reference (&5) is already finished or it is partially matched in the database. Please deselect the line and search again to get the updated matching line.':255(120703092)T-37#,t_sAPMatchingLn.PvoDomain,string(t_sAPMatchingLn.PvoID),string(t_sAPMatchingLn.PvodLineID),t_sAPMatchingLn.APMatchingLnPvodOrder,t_sAPMatchingLn.APMatchingLnPvodIntRef))
vcContext = "t_sAPMatchingLn.PvoDomain='&1'|t_sAPMatchingLn.PvoID='&2'|t_sAPMatchingLn.PvodLineID='&3'|t_sAPMatchingLn.APMatchingLnPvodOrder='&4'|t_sAPMatchingLn.APMatchingLnPvodIntRef='&5'|tqPendingVoucherForDetails.tcpvod_last_voucher='&6'|t_sAPMatchingLn.APMatchingLnPvodOpenQty='&7'|tqPendingVoucherForDetails.tdpvod_trans_qty='&8'|tqPendingVoucherForDetails.tdpvod_vouchered_qty='&9'":U
vcContext = replace(vcContext, "|", chr(2))
vcContext = substitute(vcContext, t_sAPMatchingLn.PvoDomain, t_sAPMatchingLn.PvoID, t_sAPMatchingLn.PvodLineID, t_sAPMatchingLn.APMatchingLnPvodOrder, t_sAPMatchingLn.APMatchingLnPvodIntRef, tqPendingVoucherForDetails.tcpvod_last_voucher, t_sAPMatchingLn.APMatchingLnPvodOpenQty, tqPendingVoucherForDetails.tdpvod_trans_qty, tqPendingVoucherForDetails.tdpvod_vouchered_qty)
viLocalReturnStatus = -1.
<M-24 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input 't_sAPMatchingLn.PvodLineID':U (icFieldName),
input string(t_sapmatchingln.pvodLineID) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'qadfin-59938':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input vcContext (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /* if */
/* ============================================================================== */
/* Set return-status = OK */
/* ============================================================================== */
assign oiReturnStatus = viLocalReturnStatus.