Description
With this method a Bank Number can be added, modified or deleted.
Parameters
tApiBankNumber | input | temp-table | |
tApiBankNumberPayCode | input | temp-table | |
icAction | input | character | |
ocLstPrimKey | output | character | |
ocLstReturn | output | character | |
ocLstRowid | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program9/bbanknumber.p)
/* ======================================================================================================== */
/* This method receives a temp-table (tApiBankNumber) with BankNumbers and what needs to be done with */
/* them (icAction) */
/* SAVE: Save (Create/Update) the prices when they are valid */
/* STORE: Save the prices as draft in t#-table (even when they are not valid) */
/* SAVESTORE: Save the prices when they are valid, save them as draft in t#-table when they are not valid. */
/* VALIDATE: No save done, but lets the caller know if the records in tApiBankNumber are valid (or not) */
/* ======================================================================================================== */
/* ================================================== */
/* Method info: */
/* BankNumber will be loaded based on the logical key */
/* ================================================== */
/* ============================================================================ */
/* Clear the instance: */
/* this will also clear the t_s tables that were filled in ApiMaintainByDataset */
/* ============================================================================ */
<M-52 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* ==================== */
/* Set default return */
/* Parameter validation */
/* ==================== */
assign oiReturnStatus = -98
vlDraftInstanceCreated = false.
if icAction = ? then assign icAction = "":U.
if icAction <> {&DAEMONACTION-SAVESTORE} and
icAction <> {&DAEMONACTION-SAVE} and
icAction <> {&DAEMONACTION-STORE} and
icAction <> {&DAEMONACTION-VALIDATE}
then do:
assign vcMessage = trim(subst(#T-38'A bank account number integration error occurred. The specified action (&1) must be in the list '&2'.':255(14135)t-38#,
icAction,
"{&DAEMONACTION-SAVESTORE},{&DAEMONACTION-SAVE},{&DAEMONACTION-STORE},{&DAEMONACTION-VALIDATE}":U))
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1485':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end. /* if icAction <> {&DAEMONACTION-SAVESTORE} and */
/* ======================== */
/* Count BankNumber records */
/* ======================== */
for each tApiBankNumber no-lock:
assign viMainTableRecordCount = viMainTableRecordCount + 1.
end.
if viMainTableRecordCount = 0
then do:
assign vcMessage = trim(#T-39'A bank account number integration error occurred. The system could not find main table records.':255(14136)t-39#)
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1487':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end. /* if viMainTableRecordCount = 0 */
/* ========================= */
/* Start Queries */
/* ========================= */
<Q-53 run BankNumberPrim (Start) in BBankNumber >
<Q-54 run CreditorPrim (Start) in BCreditor >
<Q-56 run DebtorPrim (Start) in BDebtor >
<Q-57 run EmployeePrim (Start) in BEmployee >
<Q-58 run GLPrim (Start) in BGL >
assign vlStartedOwnBankNumber = false.
/* ================================ */
/* Start loop on main-table records */
/* ================================ */
for each tApiBankNumber by tApiBankNumber.tc_Rowid:
MAIN-BLOCK: DO:
/* ========== */
/* Initialize */
/* ========== */
assign vcMessage = "":U
vcRowID = "":U
vlWarningsFound = false
vlSaveAsDraft = (icAction = {&DAEMONACTION-STORE}).
assign tApiBankNumber.BankNumberParentType = caps(tApiBankNumber.BankNumberParentType).
/* ================================================================================================= */
/* Retrieve the BankPayFormat based on the OwnBankNumber, PayFormatTypeCode, OwnGLAccount (optional) */
/* ================================================================================================= */
if tApiBankNumber.tcOwnBankNumber <> '':U and
tApiBankNumber.tcOwnBankNumber <> ? and
tApiBankNumber.tcPayFormatTypeCode <> '':U and
tApiBankNumber.tcPayFormatTypeCode <> ?
then do:
if vlStartedOwnBankNumber = false
then do:
<Q-65 run BankNumberForOwnBankNumber (Start) in BBankNumber >
assign vlStartedOwnBankNumber = true.
end.
<Q-66 run BankNumberForOwnBankNumber (first) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tApiBankNumber.tcOwnBankNumber, (OwnBankNumber)
input tApiBankNumber.tcOwnGLCode, (OwnGLCode)
input tApiBankNumber.tcPayFormatTypeCode, (PayFormatTypeCode)
output dataset tqBankNumberForOwnBankNumber) in BBankNumber >
find first tqBankNumberForOwnBankNumber where
tqBankNumberForOwnBankNumber.tcOwnBankNumber = tApiBankNumber.tcOwnBankNumber and
tqBankNumberForOwnBankNumber.tcPayFormatTypeCode = tApiBankNumber.tcPayFormatTypeCode
no-error.
if available tqBankNumberForOwnBankNumber
then assign tApiBankNumber.BankPayFormat_ID = tqBankNumberForOwnBankNumber.tiBankPayFormat_ID.
end.
/* ============================================== */
/* Get the BankNumber_ID based on the logical key */
/* ============================================== */
if (tApiBankNumber.BankNumber_ID = 0 or
tApiBankNumber.BankNumber_ID = ?) and
tApiBankNumber.BankNumber <> "":U and
tApiBankNumber.BankNumber <> ? and
tApiBankNumber.tcParentObjectCode <> "":U and
tApiBankNumber.tcParentObjectCode <> ? and
tApiBankNumber.BankNumberParentType <> "":U and
tApiBankNumber.BankNumberParentType <> ?
then do:
case tApiBankNumber.BankNumberParentType:
when {&BANKNUMBERPARENTTYPE-CREDITOR}
then do:
<Q-29 run CreditorPrim (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input ?, (CreditorId)
input tApiBankNumber.tcParentObjectCode, (CreditorCode)
output dataset tqCreditorPrim) in BCreditor >
find first tqCreditorPrim no-error.
if available tqCreditorPrim
then assign tApiBankNumber.ParentObject_ID = tqCreditorPrim.tiCreditor_ID.
else assign tApiBankNumber.ParentObject_ID = ?.
end. /* Creditor */
when {&BANKNUMBERPARENTTYPE-DEBTOR}
then do:
<Q-30 run DebtorPrim (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input tApiBankNumber.tcParentObjectCode, (DebtorCode)
input ?, (Debtor_ID)
output dataset tqDebtorPrim) in BDebtor >
find first tqDebtorPrim no-error.
if available tqDebtorPrim
then assign tApiBankNumber.ParentObject_ID = tqDebtorPrim.tiDebtor_ID.
else assign tApiBankNumber.ParentObject_ID = ?.
end. /* Debtor */
when {&BANKNUMBERPARENTTYPE-EMPLOYEE}
then do:
<Q-31 run EmployeePrim (all) (Read) (Cache)
(input ?, (EmployeeId)
input tApiBankNumber.tcParentObjectCode, (EmployeeCode)
input viCompanyId, (CompanyId)
output dataset tqEmployeePrim) in BEmployee >
find first tqEmployeePrim no-error.
if available tqEmployeePrim
then assign tApiBankNumber.ParentObject_ID = tqEmployeePrim.tiEmployee_ID.
else assign tApiBankNumber.ParentObject_ID = ?.
end. /* Employee */
when {&BANKNUMBERPARENTTYPE-GL}
then do:
<Q-32 run GLPrim (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input tApiBankNumber.tcParentObjectCode, (GLCode)
input ?, (GLId)
output dataset tqGLPrim) in BGL >
find first tqGLPrim no-error.
if available tqGLPrim
then assign tApiBankNumber.ParentObject_ID = tqGLPrim.tiGL_ID.
else assign tApiBankNumber.ParentObject_ID = ?.
end. /* G/L */
otherwise assign tApiBankNumber.ParentObject_ID = ?.
end case.
/* =============================================== */
/* Try to convert the logical key into the real ID */
/* =============================================== */
if tApiBankNumber.ParentObject_ID <> ? and
tApiBankNumber.ParentObject_ID <> 0
then do :
<Q-33 run BankNumberPrim (all) (Read) (NoCache)
(input ?, (BankNumberId)
input tApiBankNumber.ParentObject_ID, (ParentObjectId)
input tApiBankNumber.BankNumber, (BankNumber)
input tApiBankNumber.BankNumberExtension, (BankNumberExtension)
input ?, (BankPayFormatID)
output dataset tqBankNumberPrim) in BBankNumber >
find tqBankNumberPrim where
tqBankNumberPrim.tiParentObject_ID = tApiBankNumber.ParentObject_ID and
tqBankNumberPrim.tcBankNumber = tApiBankNumber.BankNumber and
tqBankNumberPrim.tcBankNumberExtension = tApiBankNumber.BankNumberExtension
/* BKW: Add search on BankPayFormat_ID */
and tqBankNumberPrim.tiBankPayFormat_ID = tApiBankNumber.BankPayFormat_ID
no-lock no-error.
if available tqBankNumberPrim
then assign tApiBankNumber.BankNumber_ID = tqBankNumberPrim.tiBankNumber_ID.
end. /* if tApiBankNumber.ParentObject <> ? and */
end. /* if (tApiBankNumber.BankNumber_ID = 0 or */
/* ====================== */
/* Load/Create BankNumber */
/* ====================== */
if tApiBankNumber.BankNumber_ID = ? or
tApiBankNumber.BankNumber_ID = 0
then assign viFcReturnSuper = -4.
else do:
<M-4 run DataLoad (input '':U (icRowids),
input string(tApiBankNumber.bankNumber_ID) (icPkeys),
input '':U (icObjectIds),
input ? (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* Not if tApiBankNumber.BankNumber_ID = ? or */
/* INFO: if dataload fails because of invalid ID, -4 is returned and a new record should be created */
if viFcReturnSuper = -4
then do:
<M-5 run DataNew (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper < 0
then assign vcMessage = trim(subst(#T-40'Cannot create a new instance. Error number: &1.':255(308)t-40#, string(viFcReturnSuper))).
find first tBankNumber no-error.
end. /* if viFcReturnSuper = -4 */
else do:
if viFcReturnSuper < 0
then assign vcMessage = trim(subst(#T-41'Cannot load the instance (error number: &1, instance ID: &2).':255(289)t-41#, string(viFcReturnSuper), string(tApiBankNumber.BankNumber_ID))).
else do:
find tBankNumber where
tBankNumber.BankNumber_ID = tApiBankNumber.BankNumber_ID
no-error.
if not available tBankNumber
then assign vcMessage = trim(subst(#T-42'Cannot find the instance after it has been loaded (instance ID: &1).':255(290)t-42#, string(tApiBankNumber.BankNumber_ID))).
else assign tBankNumber.tc_Status = "C":U.
end. /* Not if viFcReturnSuper <> 0 */
end. /* Not if viFcReturnSuper = -4 */
/* ====================================== */
/* Check for errors in the previous block */
/* ====================================== */
if vcMessage <> "":U
then do:
assign ocLstReturn = ocLstReturn + chr(4) + (if viFcReturnSuper = 0 then "-3":U else string(viFcReturnSuper))
ocLstPrimKey = ocLstPrimKey + chr(4) + "*":U
ocLstRowid = ocLstRowid + chr(4) + "*":U
vlSaveAsDraft = false.
<M-6 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1488':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
leave MAIN-BLOCK.
end. /* if vcMessage <> "":U */
/* ======================== */
/* Copy data for BankNumber */
/* ======================== */
/* BKW: Added BankPayFormat_ID to following (new field for business key) */
buffer-copy tApiBankNumber
except tApiBankNumber.BankNumber_ID
tApiBankNumber.tc_ParentRowid
tApiBankNumber.tc_Rowid
tApiBankNumber.tc_Status
tApiBankNumber.BankNumber
tApiBankNumber.BankNumberExtension
tApiBankNumber.BankNumberParentType
tApiBankNumber.tcParentObjectCode
tApiBankNumber.BankPayFormat_ID
to tBankNumber.
if tBankNumber.tc_Status = "N":U
then assign tBankNumber.BankNumber = tApiBankNumber.BankNumber
tBankNumber.BankNumberExtension = tApiBankNumber.BankNumberExtension
tBankNumber.BankNumberParentType = tApiBankNumber.BankNumberParentType
tBankNumber.tcParentObjectCode = tApiBankNumber.tcParentObjectCode
tBankNumber.BankPayFormat_ID = tApiBankNumber.BankPayFormat_ID.
assign vcRowid = tApiBankNumber.tc_Rowid
tApiBankNumber.BankNumber_ID = tBankNumber.BankNumber_ID /* Needed to set the prim-key after the Save */ .
/* =============================================== */
/* BankNumberPayCode */
/* =============================================== */
<M-59 run ApiStdMaintainTTDetail
(input icAction (icAction),
input-output ocLstReturn (bcLstReturn),
input-output ocLstPrimKey (bcLstPrimKey),
input-output ocLstRowid (bcLstRowId),
input-output vlSaveAsDraft (blSaveAsDraft),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper < 0
then leave main-block.
else if viFcReturnSuper > 0 then assign vlWarningsFound = true.
/* =================================================== */
/* This is where it ends if only SaveAsDraft is needed */
/* =================================================== */
if vlSaveAsDraft
then do:
assign ocLstReturn = ocLstReturn + chr(4) + "-1":U
ocLstPrimKey = ocLstPrimKey + chr(4) + "*":U
ocLstRowid = ocLstRowid + chr(4) + "*":U.
leave MAIN-BLOCK.
end. /* if vlSaveAsDraft */
/* =============================== */
/* Set Actvity */
/* =============================== */
if can-find (first tBankNumber where
(tBankNumber.tc_Status = "N":U or
tBankNumber.tc_Status = "C":U) AND
tBankNumber.BankNumberParentType = {&BANKNUMBERPARENTTYPE-CREDITOR})
then assign vcActivityCode = "SupplierBankNumberExcelIntegration":U.
else if can-find (first tBankNumber where
(tBankNumber.tc_Status = "N":U or
tBankNumber.tc_Status = "C":U) AND
tBankNumber.BankNumberParentType = {&BANKNUMBERPARENTTYPE-DEBTOR})
then assign vcActivityCode = "CustomerBankNumberExcelIntegration":U.
else assign vcActivityCode = "":U.
/* ================= */
/* Validate the data */
/* ================= */
<M-9 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper < 0
then do:
assign ocLstReturn = ocLstReturn + chr(4) + string(viFcReturnSuper)
ocLstPrimKey = ocLstPrimKey + chr(4) + "*":U
ocLstRowid = ocLstRowid + chr(4) + "*":U
vlSaveAsDraft = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE}).
leave MAIN-BLOCK.
end. /* if viFcReturnSuper <> 0 */
else if viFcReturnSuper > 0
then assign vlWarningsFound = true.
/* ================ */
/* External updates */
/* ================ */
<M-10 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper < 0
then do:
assign ocLstReturn = ocLstReturn + chr(4) + string(viFcReturnSuper)
ocLstPrimKey = ocLstPrimKey + chr(4) + "*":U
ocLstRowid = ocLstRowid + chr(4) + "*":U
vlSaveAsDraft = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE}).
leave MAIN-BLOCK.
end. /* if viFcReturnSuper <> 0 */
else if viFcReturnSuper > 0
then assign vlWarningsFound = true.
/* ============= */
/* Save the data */
/* ============= */
if icAction <> {&DAEMONACTION-VALIDATE}
then do :
<M-11 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper < 0
then do:
assign ocLstReturn = ocLstReturn + chr(4) + string(viFcReturnSuper)
ocLstPrimKey = ocLstPrimKey + chr(4) + "*":U
ocLstRowid = ocLstRowid + chr(4) + "*":U
vlSaveAsDraft = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE}).
leave MAIN-BLOCK.
end. /* if viFcReturnSuper <> 0 */
else if viFcReturnSuper > 0
then assign vlWarningsFound = true.
end. /* if icAction = {&DAEMONACTION-VALIDATE} */
/* ============================================ */
/* Indicate that everything was saved correctly */
/* ============================================ */
assign ocLstReturn = ocLstReturn + chr(4) + (if vlWarningsFound = true then "1":U else "0":U)
ocLstPrimKey = ocLstPrimKey + chr(4) + string(tApiBankNumber.BankNumber_ID)
ocLstRowid = ocLstRowid + chr(4) + vcRowID.
END. /* MAIN-BLOCK */
/* ============= */
/* Handle errors */
/* ============= */
if vlSaveAsDraft and
index(substr(ocLstReturn, r-index(ocLstReturn, chr(4)) + 1,-1,"CHARACTER":U),"-":U) <> 0 /* Negative return-status for this entry */
then do:
if vlDraftInstanceCreated = true
then do:
assign vcMessage = trim(#T-60'Only one draft instance can be created per method call.':255(13856)T-60#) +
chr(10) +
trim(#T-61'This second object cannot be stored as a draft instance and so is an error.':255(13879)t-61#).
<M-63 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3222':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
next.
end.
<M-12 run StoreState
(input trim(#T-44'The bank account number was created using an API method.':200(397)t-44#) (icDescription),
input ? (icUIClass),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign vlDraftInstanceCreated = true
entry(num-entries(ocLstReturn , chr(4)), ocLstReturn , chr(4)) = string(viFcReturnSuper)
entry(num-entries(ocLstPrimKey, chr(4)), ocLstPrimKey, chr(4)) = string(tApiBankNumber.BankNumber_ID)
entry(num-entries(ocLstRowid , chr(4)), ocLstRowid , chr(4)) = vcRowID.
end. /* if vlSaveAsDraft and */
end. /* for each tApiBankNumber: */
/* ========================= */
/* Stop Queries */
/* ========================= */
<Q-64 run BankNumberPrim (Stop) in BBankNumber >
<Q-24 run CreditorPrim (Stop) in BCreditor >
<Q-25 run DebtorPrim (Stop) in BDebtor >
<Q-26 run EmployeePrim (Stop) in BEmployee >
<Q-27 run GLPrim (Stop) in BGL >
if vlStartedOwnBankNumber = true
then do:
<Q-67 run BankNumberForOwnBankNumber (Stop) in BBankNumber >
assign vlStartedOwnBankNumber = false.
end.
/* ====================== */
/* Trim output parameters */
/* ====================== */
if length(ocLstReturn, "CHARACTER":U) > 1
then assign ocLstReturn = substring(ocLstReturn, 2,-1,"CHARACTER":U).
if length(ocLstPrimKey, "CHARACTER":U) > 1
then assign ocLstPrimKey = substring(ocLstPrimKey,2,-1,"CHARACTER":U).
if length(ocLstRowid, "CHARACTER":U) > 1
then assign ocLstRowid = substring(ocLstRowid, 2,-1,"CHARACTER":U).
if num-entries(ocLstReturn, chr(4)) <> viMainTableRecordCount or
num-entries(ocLstPrimKey, chr(4)) <> viMainTableRecordCount or
num-entries(ocLstRowid, chr(4)) <> viMainTableRecordCount
then do:
assign vcMessage = trim(#T-45'A bank account number integration error occurred. An API method returned incomplete information. See other messages for further details.':200(14142)t-45#) + chr(10) +
trim(#T-46'Main table records':100(297)t-46#) + "=":U + string(viMainTableRecordCount) + chr(10) +
trim(#T-47'Return statuses':100(298)t-47#) + "=":U + ocLstReturn + chr(10) +
trim(#T-48'Primary keys':100(299)t-48#) + "=":U + ocLstPrimKey + chr(10) +
trim(#T-49'Row IDs':100(300)T-49#) + "=":U + ocLstRowid
oiReturnStatus = -3.
<M-14 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1486':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end. /* if num-entries(ocLstReturn, chr(4)) <> viMainTableRecordCount */
/* ===================================================== */
/* Set global return status based on the individual ones */
/* ===================================================== */
if ocLstReturn = substring(fill("0":U + CHR(4),viMainTableRecordCount),1,length(ocLstReturn,"CHARACTER":U),"CHARACTER":U)
then assign oiReturnStatus = 0.
else do :
if index(ocLstReturn,"-":U) <> 0
then do :
assign vcMessage = trim(#T-50'An error has occurred while running this API method. See other error messages for more details.':255(301)T-50#)
oiReturnStatus = -1.
<M-35 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2764':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* if lookup("-":U, ocLstReturn) <> 0 */
else do :
assign vcMessage = trim(#T-51'A warning has occurred while running this API method. See other error messages for more details.':255(302)T-51#)
oiReturnStatus = +1.
<M-36 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2765':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end. /* not if lookup */
end. /* not if ocLstReturn */
Sample code: how to call this method through RPCRequestService (QXtend Inbound)
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 = "BBankNumber".
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/bbanknumber.apistdmaintaintt.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icAction = <parameter value>.
vhParameter = vhInputDS:get-buffer-handle("tApiBankNumber").
vhParameter:buffer-create().
assign vhParameter::<field-name-1> = <field-value-1>
vhParameter::<field-name-2> = <field-value-2>
...
vhParameter = vhInputDS:get-buffer-handle("tApiBankNumberPayCode").
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.