icBusinessRelation | input | character | Business relation used for filtering of debtor document (optional) |
icDebtorCode | input | character | Debtor code used for filtering of debtor documents (optional) |
icDocumentType | input | character | Type of document used for filtering of debtor documents (optional) List of expected values: - Check - Direct debit - Draft - Promissory note - Summary statement - Credit card |
icDocumentStatus | input | character | Document status used for filtering of debtor documents (optional). List of expected values: - Initial - Accepted - Portfolio - For collection - Disconto - Bounced - Paid - Paid conditionally |
iiYear | input | integer | Year of debtor document used for filtering (optional) |
iiNumber2 | input | integer | Number of debtor document used for filtering (optional) |
icReference | input | character | Reference for filtering of debtor documents (optional) |
itCreationDate | input | date | Creation date of debtor document (optional) |
itDueDate | input | date | Due date of debtor document used for filtering (optional) |
icIncSelCode | input | character | Incasso selection code for filtering of debtor documents (optional). |
icOperator | input | character | |
icBusinessRelationName | input | character | |
icBusinessRelationSearch | input | character | |
tDDocumentStatusChange | output | temp-table | Output temporary table filled with all debtor documents which fullfills all filtering parameters (Document status, Year, Number, Reference, Due date, Creation date, Debtor code, Document type, Business realation and Incasso selection code). This temporary table is primarly used later as input parameter for method ApiSetDDocumentStatusChange. List of fields in temporary table: - tlChangeFlag this field is not used - tdOriginalDebitTC original debit of debtor's document (this value cannot be changed) - tdOriginalStatus original status of debtor's document (this value cannot be changed) - Initial - Accepted - Portfolio - For collection - Disconto - Bounced - Paid - Paid conditionally - tcOriginalBankNumber original own bank number of debtor's document (this value cannot be changed) - tcOriginalGLCode original G/L account code of own bank number (this value cannot be changed) - tcBankNumber own bank number of payment document from which payment goes out. If this value is changed, during execution of method ApiSetDDocumentStatus new own bank number is assigned. - tiBankNumber_ID ID of own bank number from which payment goes out - tiBankPayFormat_ID ID of bank payment format (defines both own bank number and payment format) - tiBusinessRelation _ID ID of debtor's business relation - tcBusinessRelationCode Code of debtor's business relation - tiCompany_ID ID of company where debtor document was created - tiCurrency_ID ID of debtor document's currency - tcCurrencyCode Code of debtor document's currency - tiDDocument_ID ID of debtor document - ttDDocumentCreationDate Creation date of debtor document - ttDDocumentDueDate Due date of debtor document - tcDDocumentIncassoSelectCode Incasso selection code of debtor document - tlDDocumentIsOpen Debtor document is open - ttDDocumentLastPrintDate Last print date of debtor document - tiDDocumentNumber Debtor document number - tdDDocumentOriginalDebitLC Original debit amount in local currency - tdDDocumentOriginalDebitTC Original debit amount in transactional currency - tcDDocumentReference Reference of debtor document - tcDDocumentStatus Status of debtor document - Initial - Accepted - Portfolio - For collection - Disconto - Bounced - Paid - Paid conditionally - tcDDocumentSubType Indication of way, debtor document was created - Automatic - Manual - tiDDocumentTimesPrinted Number of times document was printed - tcDDocumentType Type of debtor document - Check - Direct debit - Draft - Promissory note - Summary statement - Credit card - tiDDocumentValueDays Value days - tiDDocumentYear Debtor document year - tiDebtor_ID ID of debtor - tcGLCode G/L code linked to company's bank number - tcPayFormatTypeCode Payment format code - ti_sequence Sequence record (internal usage) - tc_rowid Unique row identification withing a table |
oiReturnStatus | output | integer | Return status of the method. |
empty temp-table tDDocumentStatusChange. /* Validate the operator parameter */ if (icOperator = ? or icOperator = "":U) then assign icOperator = "=". if icOperator <> "=":U and icOperator <> "<=":U and icOperator <> ">=":U then do: assign vcMessage = trim(substitute(#T-32'Invalid date operator. The valid options are &1, &2 and &3.':150(57362618)T-32#,'=':U,'<=':U,'>=':U)) oiReturnStatus = -1. <M-82 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-282876':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BDDocument> return. end. if icOperator = "=":U then assign vtFromDueDate = ? vtToDueDate = ?. else if icOperator = "<=":U then assign vtToDueDate = itDueDate itDueDate = ? vtFromDueDate = ?. else if icOperator = ">=":U then assign vtFromDueDate = itDueDate itDueDate = ? vtToDueDate = ?. <Q-1 run DDocumentByChangeStatus (all) (Read) (NoCache) (input viCompanyId, (CompanyId) input icDocumentStatus, (DocumentStatus) input iiYear, (Year) input iiNumber2, (DDocumentNumber) input icReference, (Reference) input itDueDate, (DueDate) input itCreationDate, (CreationDate) input icDebtorCode, (DebtorCode) input icDocumentType, (DocumentType) input icBusinessRelation, (BusinessRelation) input icIncSelCode, (IncSelCode) input vtFromDueDate, (FromDueDate) input vtToDueDate, (ToDueDate) input icBusinessRelationName, (BusinessRelationName) input icBusinessRelationSearch, (BusinessRelationSearch) output dataset tqDDocumentByChangeStatus) in BDDocument> for each tqDDocumentByChangeStatus: create tDDocumentStatusChange. buffer-copy tqDDocumentByChangeStatus to tDDocumentStatusChange. assign tDDocumentStatusChange.tlChangeFlag = false tDDocumentStatusChange.tdOriginalDebitTC = tDDocumentStatusChange.tdDDocumentOriginalDebitTC tDDocumentStatusChange.tcOriginalStatus = tDDocumentStatusChange.tcDDocumentStatus tDDocumentStatusChange.tcOriginalBankNumber = tDDocumentStatusChange.tcBankNumber tDDocumentStatusChange.tcOriginalGLCode = tDDocumentStatusChange.tcGLCode tDDocumentStatusChange.tcOriginalPayFormatTypeCode = tDDocumentStatusChange.tcPayFormatTypeCode. tDDocumentStatusChange.tcOriginalIncassoSelectCode = tDDocumentStatusChange.tcDDocumentIncassoSelectCode. end.
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 = "BDDocument". create ttContext. assign ttContext.propertyName = "methodName" ttContext.propertyValue = "ApiGetDDocumentStatusChange". 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/bddocument.apigetddocumentstatuschange.i.xsd", ?). vhParameter = vhInputDS:get-buffer-handle("tParameterI"). vhParameter:buffer-create(). assign vhParameter::icBusinessRelation = <parameter value> vhParameter::icDebtorCode = <parameter value> vhParameter::icDocumentType = <parameter value> vhParameter::icDocumentStatus = <parameter value> vhParameter::iiYear = <parameter value> vhParameter::iiNumber2 = <parameter value> vhParameter::icReference = <parameter value> vhParameter::itCreationDate = <parameter value> vhParameter::itDueDate = <parameter value> vhParameter::icIncSelCode = <parameter value> vhParameter::icOperator = <parameter value> vhParameter::icBusinessRelationName = <parameter value> vhParameter::icBusinessRelationSearch = <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.