Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Hello SAPers!

Here is another post, where I’d like to share a couple of details about SAP’s functionality. This post as many others that I share deals with functionalities around bank statement processing. Setup of bank statement reconciliation in SAP as a rule is quite simple and intuitive, but sometimes you have to deal with more difficult topics, which are not covered by standard customizing. This post explores the mechanism behind uploading of bank statement in XML-format. Please also check out my other post on import of bank statements in CSV format.  I hope you’ll find something interesting for you.

1.   Introduction

Best practices for bank reconciliation in SAP imply upload of electronic bank statements and their postprocessing. Most banks provide bank statements in format MT940, BAI or Multicash which are well supported by SAP. These are the most popular formats, though there are other formats which SAP supports as well. However, once upon a time you’ll have to deal with some bank that doesn’t support these formats and provides statements in its own format. This post explores the options behind configuration of bank-specific statements in XML-format.

Example of bank statement in XML-format can be found below. This is dummy bank statement devised by me specifically for this example and any similarities with real life bank statements are coincidental.
<?xml version="1.0" encoding="windows-1251"?>
<line rownum="1">
<note>Payment for consulting services, invoice #1800000018 from 01.01.2018, contract #10 from 01.01.2018</note>
<bp_name>Sport Country LLC</bp_name>
<line rownum="2">
<note>Payment for utility services, invoice #431 from 01.12.2017</note>
<bp_name>Utility Investments LLD</bp_name>

2.   Overview of development objects and configuration activities

First step is to develop XSLT-transformation that will parse bank statement and transform it into internal table with type TTY_FEB_STATEMENT. This internal table contains two item components:

  • FEBKO – which stores requisites of bank statement header;

  • ITEMS_FEB, which in turn consists of internal tables storing line item data (i.e. FEBEP), note to payee (i.e. VWEZW) and clearing data (i.e. FEBCL).

Representation of a variable with this data type in a debug mode can be found below:

Main responsibility of a consultant with regards to this task is to prepare a mapping between tags of XML-files and fields of target structure. Check out the contents of standard tables FEBKO, FEBEP and FEBCL in SAP to understand which fields should be filled and what are the rules for data formatting.

Transformation should be created by a developer (in t-code STRANS). But if you want to do it yourself, you can check out an example below:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<!-- Bank statement header data -->
<xsl:for-each select="/statement/head">
<xsl:variable name="stmtCurrency">
<xsl:value-of select="currency"/>
<xsl:variable name="stmtDate">
<xsl:value-of select="concat(substring(stmt_date,5,4), substring(stmt_date,3,2), substring(stmt_date,1,2))"/>
<xsl:value-of select="stmt_no"/>
<xsl:value-of select="$stmtDate"/>
<xsl:value-of select="stmtCurrency"/>
<xsl:value-of select="'1'"/>
<xsl:value-of select="bank_key"/>
<xsl:value-of select="account_no"/>
<xsl:value-of select="open_balance"/>
<xsl:value-of select="end_balance"/>

<!-- Bank statement line data -->
<xsl:for-each select="/statement/linedata/line">
<xsl:variable name="sign">
<xsl:value-of select="dr_cr"/>
<xsl:value-of select="$stmtDate"/>
<xsl:value-of select="$stmtDate"/>
<xsl:value-of select="$stmtDate"/>
<xsl:value-of select="$stmtCurrency"/>
<xsl:value-of select="amount"/>
<!-- Transaction code -->
<xsl:value-of select="btc"/>
<!-- Business partner details -->
<xsl:value-of select="bp_bank_acc"/>
<xsl:value-of select="bp_name"/>
<xsl:value-of select="bp_bank_key"/>
<xsl:when test="$sign='C'">
<xsl:value-of select="'H'"/>
<xsl:value-of select="'S'"/>
<xsl:value-of select="note"/>
<!-- Note to Payee -->
<xsl:value-of select="note"/>

Next step is to define new format for your bank statement in XML-format and link it to XSLT-transformation. Use customizing view VFIEB_MAPP_XCTRL or the following menu path to perform this activity:

SPRO → Financial Accounting (new) → Bank Accounting → Business Transactions → Payment Transactions → Electronic Bank Statement → XML Format and Bank-Specific Formats.

Once you prepared XSLT-transformation and maintained mapping procedure, you can attempt to load bank statement. Go to FF_5 and choose “XML or Bank-Specific Format” option. Once you select it, additional drop-down list will appear, where you can select your custom format. Provide the reference to file path and fill the rest of the screen as usual.

The results of the upload can be found below:

P.S. This post doesn’t describe basic configuration of bank statement, which is also required for bank statement processing e.g. setup of house bank / account IDs, setup of posting rules, transaction types for bank statement etc. Customizing in these areas is standard for any bank statement and well explained.

I hope that you have learn something useful once you reached this sentcen. I’m looking forward to your comments and remarks.


Best regards, 

Bohdan Petrushchak
Labels in this area