Skip to Content
Product Information
Author's profile photo Sissi Ruthe

Web Service for Bank Statements

The objective of this blog post is to introduce the new web service for bank statements in SAP Business ByDesign 2102.

In 2011 we developed the ManageBankStatementIn web service and executed a Beta Release for it. During the Beta Release we got very positive feedback and now, with release 2102 the web service interface Manage Bank Statements is general available. It enables you to create and edit bank statements in your system by connecting external applications to SAP Business ByDesign.

The web service creates a bank statement like the creation of a manual bank statement in the Liquidity Management work center. Therefore, it is independent of the file format provided by the bank and cannot be compared with the existing Bank Statement Upload functionality in the system.

The intention of this web service is to support

  • the mass upload of bank statements,
  • or the automatic creation of bank statements with file formats which are not supported by the existing Bank Statement Upload functionality

by building partner or customer-specific solutions.

You find the web service in the Application and User Management work center under Input and Output Management – Service Explorer. Just enter Bank Statement in the Search field and start the search.

When you select a line, like for example the Check bank statements operation, you will find a link to further Documentation under Details: Manage Bank Statements – Check bank statements. The documentation also provides a simple web service request which uses the MaintainBundle operation to create a new bank statement.

In case you need further general information related to the use of web service APIs (SOAP) please read this blog post SAP Business ByDesign – API Overview from my colleague Knut Heusermann.

This explanation shall help you to understand how to use the new web service for bank statements in SAP Business ByDesign 2102.

Assigned tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Christian Warken
      Christian Warken

      This is great that there is finally an alternative to the existing Bank Statement Upload.

      Until now we just had the possibility to automatize the upload of standardized MT940 or CAMT files wherefor we already developed some solutions for our customers.

      I am curious to test it.

      Regards

      Author's profile photo Tobias Czech
      Tobias Czech

      It has been possible for a long time to upload bank statements via oData Service and to release them via Function Import.

      oData BO Company Payment File Register / Incoming File / Attachment Folder using POST method.
      The MT940 file can be included as base 64 string.

      The bank statement can then be released via the function Import StartPaymentUpdate.

       

      Regards

      Author's profile photo Sissi Ruthe
      Sissi Ruthe
      Blog Post Author

      Hi Tobias,

      thanks for your comment. The idea of this web service we delivered is to be independent of the bank statement file format such as MT940, so that it is possible to upload bank statement file formats which are not supported in ByD standard. In case of non-localized countries this is a typical requirement.

      Best regards,

      Sissi

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi Tobias,

      Do you know if it possible to upload CAMT053/ISO20022 files using the oData webservices?

      Author's profile photo Tobias Czech
      Tobias Czech
      Hi Ronald,
      ISO20022 is a pre-delivered bank statement file format in SAP ByD. So this works as well.
      Here is a JSON for the POST request:
      http://myXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/companypaymentfileregister/IncomingFileCollection
      {
          "ParentObjectID": "COMPANY UUID",
          "HouseBankUUID": "HOUSEBANK UUID",
          "ContentTypeCode": "1",
          "AttachmentFolder": [
              {
                  "CategoryCode": "2",
                  "TypeCode": "10001",
                  "Title": "BANKSTATEMENT123.TXT}",
                  "Name": "BANKSTATEMENT123-NAME.TXT",
                  "MimeType": "text/plain",
                  "Binary":
              Enter your CAMT053/ISO20022 binary string here
              }
          ]
      }
      To get right Company UUID and HouseBank UUID for the POST request, you have to query Company Details as well as HouseBank Details upfront. Both can be queried with ODATA as well upfront.
      Hope this helps
      Regards,
      Tobias
      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi Tobias,

      Thank you for your reply and confirmation.

      I am testing this with Postman and it seems to work fine.

      I do have a challenge using our interface language's web client to work with the Post commands as they need to have the cookies from the Get command next to the token to work. I notice that more people have that challenge so I should manage to make this work

      Thanks again

      Author's profile photo Tobias Czech
      Tobias Czech

      Hi Ronald,

       

      you have to fetch the x-csrf-token from a GET command.

      Add key x-csrf-token in the Get Header. Once invoked GET request, you can extract the x-csrf-token value from the Get Header Response: (check screenshot)

       

      Now add the key x-csrf-token to the POST header. Use the responded token as value.

      Regards,

      Tobias

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi Tobias,

      Yes, that was what I found to, but I also learned that Postman automatically adds the cookies from the Get session in the headers of the Post request, while other web clients do not do that automatically and then you have to arrange for that. See also this blog post around the same problem I encounter: Issues with CSRF token and how to solve them | SAP Blogs

       

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi Sissi,

      Thanks for sharing, we are investigating the use of this webservice but cannot find a good soap xml example on how to utilize the Document element to upload a bankstatement using this webservice.

      Manage Bank Statements | API | SAP API Business Hub

      Do you have an example?

       

      Author's profile photo Sissi Ruthe
      Sissi Ruthe
      Blog Post Author

      Hi Ronald,

      did you check the examples in the Manage Bank Statements | API | SAP API Business Hub documentation? If yes, what is missing in the examples?

      Best regards,

      Sissi

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi Sissi,

      Yes, I did and I referred to the same documentation in my previous post 🙂 But I would like to see an example where a document is attached as binary object in the soap envelop. If that is possible at all. See also my screenshot as reply below to the post of François-Xavier.

      Author's profile photo François-Xavier LEPOUTRE
      François-Xavier LEPOUTRE

      Hi Ronald,

      Here's a working example from our side if it helps.

      Cheers,

      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
        <soapenv:Body>
          <glob:BankStatementBundleMaintainRequest_sync>
            <BankStatement ActionCode="01">
              <CompanyID>COMPANY</CompanyID>
              <HouseBankAccount>
                <ID>DFR00006</ID>
              </HouseBankAccount>
              <StatementDate>2021-05-20</StatementDate>
              <PostingDate>2021-05-20</PostingDate>
              <OpeningBalanceAmount currencyCode="EUR">0</OpeningBalanceAmount>
              <ClosingBalanceAmount currencyCode="EUR">0</ClosingBalanceAmount>
              <CreditTotalAmount currencyCode="EUR">1409.84</CreditTotalAmount>
              <DebitTotalAmount currencyCode="EUR">1409.84</DebitTotalAmount>
              <Item ActionCode="01">
                <ItemID>1</ItemID>
                <PostedAmount currencyCode="EUR">0.84</PostedAmount>
                <BusinessProcessVariantTypeCode>48</BusinessProcessVariantTypeCode>
                <PaymentReference>
                  <ID/>
                </PaymentReference>
                <BankValueDate>2021-05-20</BankValueDate>
                <BankPostingDate>2021-05-19</BankPostingDate>
                <PaymentExplanationNote>
                  <Note/>
                </PaymentExplanationNote>
              </Item>
              <Item ActionCode="01">
                <ItemID>2</ItemID>
                <PostedAmount currencyCode="EUR">1409.0</PostedAmount>
                <BusinessProcessVariantTypeCode>48</BusinessProcessVariantTypeCode>
                <PaymentReference>
                  <ID>1759214121714884</ID>
                </PaymentReference>
                <BankValueDate>2021-05-20</BankValueDate>
                <BankPostingDate>2021-05-19</BankPostingDate>
                <PaymentExplanationNote>
                  <Note>1759214999914884</Note>
                </PaymentExplanationNote>
              </Item>
              <Item ActionCode="01">
                <ItemID>3</ItemID>
                <PostedAmount currencyCode="EUR">-1385.0</PostedAmount>
                <PaymentReference>
                  <ID/>
                </PaymentReference>
                <BankValueDate>2021-05-20</BankValueDate>
                <BankPostingDate>2021-05-20</BankPostingDate>
                <PaymentExplanationNote>
                  <Note/>
                </PaymentExplanationNote>
              </Item>
              <Item ActionCode="01">
                <ItemID>4</ItemID>
                <PostedAmount currencyCode="EUR">-24.84</PostedAmount>
                <PaymentReference>
                  <ID/>
                </PaymentReference>
                <BankValueDate>2021-05-20</BankValueDate>
                <BankPostingDate>2021-05-20</BankPostingDate>
                <PaymentExplanationNote>
                  <Note>FEES</Note>
                </PaymentExplanationNote>
              </Item>
              <ReleaseBankStatement>true</ReleaseBankStatement>
            </BankStatement>
          </glob:BankStatementBundleMaintainRequest_sync>
        </soapenv:Body>
      </soapenv:Envelope>

      And it integrates properly in SAP:

       

      Hope it helps,

      FX

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi François-Xavier,

      Thank you for your response. My question was about adding an document in the soap envelope as binary object as partly described in the documentation. I am hoping it facilitates a way to upload the whole bank statement as file into the Incoming Files work center.

      Author's profile photo François-Xavier LEPOUTRE
      François-Xavier LEPOUTRE

      Hi Ronald,

      From my understanding, the "Manage Bank Statements" webservice documented here does not put anything in the "Incoming Files" work center, and creates directly the Bank Statement object, bypassing the whole mechanism of uploading a file, and translating it from a bank standard (for example MT940 UK, BAI2 US, AFB, etc...) to an SAP object.

      The Attachment node documented in your screenshot is only adding an attachment in the Attachment tab of the bank statement, which therefore can be of any format supported by SAP.

      The process of adding those attachments through webservice works globally the same for any object, and is described here: https://blogs.sap.com/2015/10/08/read-and-write-bydesign-attachments-using-web-services/

      If your objective is to upload a file in the Incoming Files work center and use the standard SAP mechanisms to translate it from a bank standard (for example MT940 UK, BAI2 US, AFB, etc...) to an SAP object, then this is not covered in SAP standard webservices. On our side, before the "Manage Bank Statements" webservice existed, we had requested our partner to create a webservice for us that allowed to upload files programmatically, so they became visible in the "Incoming Files" work center, and could be processed as if you had done a manual upload.

      I hope it's clearer.

      Cheers,

      FX

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Dear François-Xavier,

      Thank you for clarifying that. We have seen an custom webservice with another party as well for the incoming files upload.

      For now I will look into the oData suggestion of Tobias above using the CompanyPaymentFileRegister object. I saw that @KnutHeusermann also has an example for that in his example set called: Create bank statement as incoming file.

      I only do not know if I then can set the file format to CAMT053/ISO20022 using that.

      When doing an upload manually of a bankstatement that works well. So if I could automated that then I do not need to extract all the data from a bankstatement to created the correct soap envelop for that.

      I will keep you updated here of my progress.

      Author's profile photo Ronald van Herk
      Ronald van Herk

      Hi François-Xavier,

      I will go with the OData option, see my reply to the post of Tobias above: https://blogs.sap.com/2021/02/10/web-service-for-bank-statements/comment-page-1/#comment-572729