Wednesday, August 15, 2018

Creating XML Banking document from template

Leave a Comment

I have this template from a bank that is used to make payments on bank account transfers.

See xml below. I have included the samlple data that has to be entered when sending the file to the bank.

<?xml version="1.0" encoding="UTF-8"?> <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   <CstmrCdtTrfInitn>     <GrpHdr>       <MsgId>Copy Cart Urgent28052018_57894</MsgId>       <CreDtTm>2018-06-29T11:52:23</CreDtTm>       <NbOfTxs>1</NbOfTxs>       <CtrlSum>667896.00</CtrlSum>       <InitgPty>         <Nm>COPY CART LIMITED</Nm>         <Id>           <OrgId>             <Othr>               <Id>S001234/PJones</Id>               <SchmeNm>                 <Cd>CUST</Cd>               </SchmeNm>             </Othr>           </OrgId>         </Id>       </InitgPty>     </GrpHdr>     <PmtInf>       <PmtInfId>Payment for addon development SAP B1</PmtInfId>       <PmtMtd>TRF</PmtMtd>       <BtchBookg>false</BtchBookg>       <NbOfTxs>1</NbOfTxs>       <CtrlSum>667896.00</CtrlSum>       <PmtTpInf>         <InstrPrty>HIGH</InstrPrty>       </PmtTpInf>       <ReqdExctnDt>2018-06-29</ReqdExctnDt>       <Dbtr>         <Nm>COPY CART LIMITED</Nm>       </Dbtr>       <DbtrAcct>         <Id>           <Othr>             <Id>0100000110846</Id>           </Othr>         </Id>         <Ccy>KES</Ccy>       </DbtrAcct>       <DbtrAgt>         <FinInstnId>           <BIC>SBICKENX</BIC>          </FinInstnId>       </DbtrAgt>       <CdtTrfTxInf>         <PmtId>           <EndToEndId>156335578965</EndToEndId>         </PmtId>         <Amt>           <InstdAmt Ccy="KES">667896.00</InstdAmt>         </Amt>         <ChrgBr>DEBT</ChrgBr>         <CdtrAgt>           <FinInstnId>             <BIC>DTKEKENA</BIC>             <ClrSysMmbId>               <MmbId>63000</MmbId>             </ClrSysMmbId>           </FinInstnId>         </CdtrAgt>         <Cdtr>           <Nm>EOH SEAL LTD</Nm>           <PstlAdr>             <StrtNm>P.O. Box 10496</StrtNm>             <TwnNm>Nairobi</TwnNm>             <Ctry>KE</Ctry>             <AdrLine>P.O. Box 10496</AdrLine>             <AdrLine>00100 NAIROBI</AdrLine>           </PstlAdr>         </Cdtr>         <CdtrAcct>           <Id>             <Othr>               <Id>0112406001</Id>             </Othr>           </Id>         </CdtrAcct>         <RmtInf>           <Ustrd>Copy Cat Urgent28052018_57894</Ustrd>         </RmtInf>       </CdtTrfTxInf>         </PmtInf>   </CstmrCdtTrfInitn> </Document> 

The file is quite long as has to be in the format given. The black letters represent the details to be passed to the xml. To test if I understood what data goes where I filled it manually and sent to bank for testing. That is all good now.

I have a SAP addon program that captures details from a form and generates a list. Each payment must follow this structure.

Looking at the below:

<Nm>COPY CART LIMITED</Nm> <Id>   <OrgId>     <Othr>       <Id>S001234/PJones</Id>       <SchmeNm>         <Cd>CUST</Cd>       </SchmeNm>     </Othr>   </OrgId> </Id>    

Is creating a class with all properties according to the template the best way to create the xml needed.

How do I stagger the

<Id>    <OrgId>       <Othr> 

as in the case above?

Also the <CtrlSum>667896.00</CtrlSum> is found in the group header and payment info tags. How do I deal with this?

1 Answers

Answers 1

For what i see, the problem is you have a addon in SAP to specify multiple payments methods, but in the XML template given from the bank you don't the structure for multiple payments, so you need to get this information to know how can you work with it.

when you have this information you can use a better XML template with VS or another tool to generate the correct class to work with the XML

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment