project QadFinancials > class BBankNumber > method ApiLoadSupplierBankNumber
Description
This method is used on the UI for Excel Integration. It returns Supplier BankNumbers so they can be shown in the Excel Integration grid.
Parameters
tApiBankNumber | output | temp-table | Temp-table to pass the BankNumber records that match the input parameters |
tApiBankNumberPayCode | output | temp-table | Temp-table to pass the BankNumberPayCode records that match the input parameters |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program9/bbanknumber.p)
empty temp-table tApiBankNumber.
empty temp-table tApiBankNumberPayCode.
/* Get the data and populate the table tApiBankNumber */
<Q-45 run BankNumberForExcelIntegration (all) (Read) (NoCache)
(input {&BANKNUMBERPARENTTYPE-CREDITOR}, (BankNumberParentType)
input viCompanyId, (CompanyId)
output dataset tqBankNumberForExcelIntegration) in BBankNumber >
<Q-21 run CreditorPrim (Start) in BCreditor >
<Q-52 run CInvoiceBankByBankNumberID (Start) in BCInvoice >
<Q-54 run BankNumberForCDocument (Start) in BBankNumber >
for each tqBankNumberForExcelIntegration:
create tApiBankNumber.
<M-47 run BufferCopy
(input buffer tqBankNumberForExcelIntegration:handle (ihFrom),
input buffer tApiBankNumber:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign tApiBankNumber.tcOwnGLCode = tqBankNumberForExcelIntegration.tcGLCode
tApiBankNumber.tcPayFormatTypePaymentInstrument = tqBankNumberForExcelIntegration.tcPayFormatTypePayInstrument.
/* Check whether the bank number is linked with an invoice */
<Q-50 run CInvoiceBankByBankNumberID (all) (Read) (NoCache)
(input tApiBankNumber.BankNumber_ID, (BankNumberID)
output dataset tqCInvoiceBankByBankNumberID) in BCInvoice >
find first tqCInvoiceBankByBankNumberID where
tqCInvoiceBankByBankNumberID.tiBankNumber_ID = tApiBankNumber.BankNumber_ID
no-error.
if available tqCInvoiceBankByBankNumberID
then assign tApiBankNumber.tlBankNumberIsReferenced = true.
else assign tApiBankNumber.tlBankNumberIsReferenced = false.
/* Check whether the bank number is linked with a payment */
<Q-51 run BankNumberForCDocument (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tApiBankNumber.BankNumber_ID, (BankNumberId)
output dataset tqBankNumberForCDocument) in BBankNumber >
find first tqBankNumberForCDocument where
tqBankNumberForCDocument.tiBankNumber_ID = tApiBankNumber.BankNumber_ID
no-error.
if available tqBankNumberForCDocument
then assign tApiBankNumber.tlExistRecord = false.
else assign tApiBankNumber.tlExistRecord = true.
/* Fill in the ParentObjectCode based on the ID */
if tApiBankNumber.ParentObject_ID > 0
then do:
<Q-46 run CreditorPrim (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input tApiBankNumber.ParentObject_ID, (CreditorId)
input ?, (CreditorCode)
output dataset tqCreditorPrim) in BCreditor >
find first tqCreditorPrim no-error.
if available tqCreditorPrim
then assign tApiBankNumber.tcParentObjectCode = tqCreditorPrim.tcCreditorCode.
else do:
delete tApiBankNumber.
next.
end.
end.
else do:
delete tApiBankNumber.
next.
end.
end. /* for each tqBankNumberForExcelIntegration */
<Q-25 run CreditorPrim (Stop) in BCreditor >
<Q-53 run CInvoiceBankByBankNumberID (Stop) in BCInvoice >
<Q-55 run BankNumberForCDocument (Stop) in BBankNumber >
/* Get the data and populate the table tApiBankNumberPayCode */
<Q-48 run BankNumberPayCodeForExcelInteg (all) (Read) (NoCache) (output dataset tqBankNumberPayCodeForExcelInteg) in BBankNumber >
for each tqBankNumberPayCodeForExcelInteg,
first tApiBankNumber where
tApiBankNumber.BankNumber_ID = tqBankNumberPayCodeForExcelInteg.tiBankNumber_ID:
create tApiBankNumberPayCode.
<M-49 run BufferCopy
(input buffer tqBankNumberPayCodeForExcelInteg:handle (ihFrom),
input buffer tApiBankNumberPayCode:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if tqBankNumberPayCodeForExcelInteg.tcPayFormatCode = "":U OR
tqBankNumberPayCodeForExcelInteg.tcPayFormatCode = ?
then assign tApiBankNumberPayCode.BankNumberPayCodeValue = tqBankNumberPayCodeForExcelInteg.tcBankNumberPayCodeValue.
else assign tApiBankNumberPayCode.BankNumberPayCodeValue = tqBankNumberPayCodeForExcelInteg.tcPayFormatCode.
assign tApiBankNumberPayCode.tc_ParentRowid = tApiBankNumber.tc_Rowid
tApiBankNumberPayCode.tc_Rowid = tqBankNumberPayCodeForExcelInteg.tc_rowid.
end. /* for each tqBankNumberPayCodeForExcelInteg */
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 = "ApiLoadSupplierBankNumber".
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 = "".
/* 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.