Description
This method used to generated the bank dirver file repeatively.
Parameters
iiCCollection_ID | input | integer | |
icTransferFilePath | input | character | TransferFilePath |
ilisIndividualInvoices | input | logical | |
ilIsDuplicate | input | logical | |
oiCollectionGLId | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bpaymentselection.p)
/* Change - WouAnt - 3 06 2005 : The field Individual Invoices should not be selected from
Transfer activity. This indicator indicates if Grouping is allowed or not - and according to us
it is always allowed and is depending on Creditor setting */
assign ilIsIndividualInvoices = NO.
if vcActivityCode = "":U or
vcActivityCode = ?
then assign vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN}.
/* XS BTS 1782 01/04/2005 JirHol */
if ilIsDuplicate = ? then assign ilIsDuplicate = false.
/*
if icUrgentClearing = ? or
lookup(icUrgentClearing, {&PAYMENTSELECTIONCLEARINGS}, chr(2)) = 0
then assign icUrgentClearing = {&PAYMENTSELECTIONCLEARING-NOTSPECIFIED}.
*/
assign vlIsDuplicate = ilIsDuplicate.
/* vcUrgentClearing = icUrgentClearing */
/* XE BTS 1782 01/04/2005 JirHol */
empty temp-table tCDocumentPaySel.
empty temp-table tCDocumentInvoiceXRefPaySel.
/* Check the directory */
/* comment we don't need the this directory in bank driver solution EA */
/*
<M-3 run CheckValidDirectory (input icTransferFilePath (icTransferFilePath),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = -1.
return.
end.*/
empty temp-table tCDocumentInfoForCollection.
empty temp-table tCCollectionPaySel.
empty temp-table tUpdateCDocumentColl.
if iiCCollection_ID = 0
then do:
<M-68 run SetMessage
(input #T-88'The specified selection is not defined in the system or is invalid.':100(2969)T-88# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-536683':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
<Q-29 run CCollectionByAllocation (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (CCollectionReference)
input ?, (FromRequestedDate)
input ?, (CCollectionOriginalTC)
input iiCCollection_ID, (CCollectionID)
input ?, (GLCode)
input ?, (GLId)
input ?, (PaySelCode)
output dataset tqCCollectionByAllocation) in BCCollection >
find first tqCCollectionByAllocation no-error.
if not available tqCCollectionByAllocation
then do:
<M-30 run SetMessage
(input #T-49'The specified selection is not defined in the system or is invalid.':100(2969)t-49# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2508':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
<Q-31 run GLPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (GLCode)
input tqCCollectionByAllocation.tiGL_ID, (GLId)
output dataset tqGLPrim) in BGL >
find first tqGLPrim no-error.
if not available tqGLPrim
then do:
<M-32 run SetMessage
(input #T-50'GL bank account ($1) is not defined in the system.':100(2970)t-50# (icMessage),
input string(tqccollectionByAllocation.tiGL_ID) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2509':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
create tCCollectionPaySel.
assign viSeq = viSeq + 1
tCCollectionPaySel.CCollection_ID = iiCCollection_ID
tCCollectionPaySel.CCollectionReference = tqCCollectionByAllocation.tcCCollectionReference
/* BTS 4747 - JLA */
tCCollectionPaySel.CCollectionName = #T-51'Electronic Transfer':40(4361)T-51#
/* BTS 4747 - JLA */
tCCollectionPaySel.CCollectionNumber = tqCCollectionByAllocation.tiCCollectionNumber
tCCollectionPaySel.CCollectionRequestedDate = today
tCCollectionPaySel.CCollectionYear = year(today)
tCCollectionPaySel.Company_ID = viCompanyId
tCCollectionPaySel.GL_ID = tqCCollectionByAllocation.tiGL_ID
tCCollectionPaySel.tcGLCode = tqGLPrim.tcGLCode
tCCollectionPaySel.tc_Rowid = string(viSeq)
tCCollectionPaySel.tc_Status = "N":U
/*The following 2 stataments added by shx */
tCCollectionPaySel.CCollectionIsAutomatic = tqCCollectionByAllocation.tlCCollectionIsAutomatic
tCCollectionPaySel.CCollectionIsExecuted = tqCCollectionByAllocation.tlCCollectionIsExecuted
oiCollectionGLId = tqCCollectionByAllocation.tiGL_ID.
<Q-36 run CDocumentForRepTransPaym (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCCollection_ID, (CCollectionId)
output dataset tqCDocumentForRepTransPaym) in BCDocument >
for each tqCDocumentForRepTransPaym
break by tqCDocumentForRepTransPaym.ti_sequence:
<Q-37 run PaySelLineByPaySel (all) (Read) (NoCache)
(input ?, (PaySel_ID)
input tqCDocumentForRepTransPaym.tiPaySelLine_ID, (PaySelLine_ID)
output dataset tqPaySelLineByPaySel) in BPaymentSelection >
find first tqPaySelLineByPaySel no-error.
if not available tqPaySelLineByPaySel
then do:
<M-38 run SetMessage
(input #T-52'The system cannot locate the payment selection line.':100(2971)t-52# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2510':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
find first tCDocumentInfoForCollection where
tCDocumentInfoForCollection.tiCDocument_ID = tqCDocumentForRepTransPaym.tiCDocument_ID and
tCDocumentInfoForCollection.tcPayFormatTypeCode = tqPaySelLineByPaySel.tcPayFormatTypeCode
no-error.
if not available tCDocumentInfoForCollection
then do:
create tCDocumentInfoForCollection.
assign tCDocumentInfoForCollection.tiCDocument_ID = tqCDocumentForRepTransPaym.tiCDocument_ID
tCDocumentInfoForCollection.tcPayFormatTypeCode = tqPaySelLineByPaySel.tcPayFormatTypeCode.
end.
find first tPaySel where
tPaySel.PaySel_ID = tqPaySelLineByPaySel.tiPaySel_ID no-error.
if not available tPaySel
then do:
<M-39 run DataLoad
(input '':U (icRowids),
input tqPaySelLineByPaySel.tiPaySel_ID (icPkeys),
input '':U (icObjectIds),
input '' (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0
then do:
<M-40 run SetMessage
(input #T-53'The data could not be loaded. The system was unable to modify the payment selection.':100(2965)t-53# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2511':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
end.
if not available tPaySel
then do:
if can-find(first tPaySel where tPaySel.PaySel_ID = tqPaySelLineByPaySel.tiPaySel_ID)
then do:
find first tPaySel where tPaySel.PaySel_ID = tqPaySelLineByPaySel.tiPaySel_ID.
end.
else do:
<M-41 run SetMessage
(input #T-54'The data have been successfully loaded, but the record is not available.':100(2972)T-54# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2512':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -1.
return.
end.
end.
/* Check Execution Date */
if tPaySel.PaySelDate < today
then do:
<M-45 run SetMessage
(input trim(substitute(#T-55'The execution date cannot be earlier than today (payment selection: &1).':200(2973)T-55#, tPaySel.PaySelCode)) (icMessage),
input '':U (icArguments),
input 'tPaySel.PaySelDate':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input tPaySel.tc_Rowid (icRowid),
input 'QADFIN-2689':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if oiReturnStatus = 0
then assign oiReturnStatus = 1.
end.
if first(tqCDocumentForRepTransPaym.ti_sequence)
then do:
assign tCCollectionPaySel.tiPaySel_ID = tPaySel.PaySel_ID
tCCollectionPaySel.tcPayFormatType = tqPaySelLineByPaySel.tcPayFormatTypeCode
/* BTS 4747 - JLA */
tCCollectionPaySel.CCollectionPaySelCodeList = tPaySel.PaySelCode.
/* BTS 4747 - JLA */
/* comment by shx we don't need the this directory in bank driver solution EA */
/*
<M-44 run GetFileName (input tqPaySelLineByPaySel.tcPayFormatTypeCode (icPayFormatTypeCode),
input icTransferFilePath (icTransferFilePath),
output tCCollectionPaySel.tcOutputFileName (ocOutputFileName),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
*/
end.
create tCDocumentInvoiceXRefPaySel.
assign viCDocXrefSequence = viCDocXrefSequence + 1
tCDocumentInvoiceXrefPaySel.PaySelLine_ID = tqCDocumentForRepTransPaym.tiPaySelLine_ID
tCDocumentInvoiceXRefPaySel.CDocument_ID = tqCDocumentForRepTransPaym.tiCDocument_ID
tCDocumentInvoiceXrefPaySel.tc_Rowid = string(viCDocXrefSequence)
tCDocumentInvoiceXrefPaySel.tc_Status = 'N':U.
end.
/* Produce the file */
<M-26 run GenerateASCII (input oiCollectionGLId (iiBankGL_ID),
input ilisIndividualInvoices (ilisIndividualInvoices),
input true (ilisRepetitiveTransfer),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
/* let's remove the files if the action was not completted ok */
for each tCCollectionPaySel where
tCCollectionPaySel.tc_Status <> ' ':U
break by tCCollectionPaySel.tcOutputFileName:
if first-of(tCCollectionPaySel.tcOutputFileName) and
search(tCCollectionPaySel.tcOutputFileName) <> ?
then os-delete value(tCCollectionPaySel.tcOutputFileName).
end.
return.
end.
/*always skip validations*/
assign vlFcDataValidated = true.
/*save*/
<M-48 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
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 = "BPaymentSelection".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiRepetitiveTransferPayments".
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/bpaymentselection.apirepetitivetransferpayments.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::iiCCollection_ID = <parameter value>
vhParameter::icTransferFilePath = <parameter value>
vhParameter::ilisIndividualInvoices = <parameter value>
vhParameter::ilIsDuplicate = <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.