My previous post focused on the baseline process around import of bank statements in Fiori. This post explores additional enhancements that are necessary if you want to upload bank statements in bank specific formats e.g., XML, CSV, JSON etc.
If your bank does not provide bank statements in a commonly recognized format (e.g., MT940, Multicash, BAI etc.), you can configure SAP to upload bank statements in any structured format. I’ve started exploring this topic in my previous posts and recommend checking them out. Configurations described in those posts are technical pre-requisites and will provide a good starting point for this post. The links to these posts are provided below:
This post will describe how to upload a bank statement in CSV format, but it will focus on Fiori-specific settings & enhancements. However, the idea can be applied to bank statement in any structured i.e., machine-readable format.
This post does not describe the parsing logic for CSV file or how the resulting data should be mapped against standard SAP tables that store transactional details of bank statements. These details were described in separate post mentioned above.
Four separate enhancements (i.e., BADIs) are required before you can upload such bank statements to SAP. Two of these enhancements are specific to Fiori. One of these enhancements checks if the bank statement file is compliant with the list of configured formats. Another one – calculates the number of bank statements in the file. Two more enhancements are executed in backend and were described in my earlier post.
Baseline configuration of new bank statement format
Define new bank statement format in view VFIEB_MAPP_XCTRL. You can also use the following menu path for this configuration activity:
SPRO → Financial Accounting → Bank Accounting → Business Transactions → Payment Transactions → Electronic Bank Statement → XML Format and Bank-Specific Formats.
Configure new bank statement format for upload of bank statement. Use the following menu path to configure the format. Alternatively, you can use t-code S_ER9_11000399 or maintenance view VC_FAR_IPF (via SM34) to configure it.
SPRO → Financial Accounting → Bank Accounting → Business Transactions → Payment Transactions → Electronic Bank Statement → Configure Formats for Import (SAP Fiori).
Essentially, you define a new bank-specific bank statement format (value “X” in drop-down list stands for bank-specific format) and link it to the format defined earlier (i.e., in view VFIEB_MAPP_XCTRL). Entry UA_PRV in the configuration represents the transaction type (i.e., t-code OT83) that will be used for derivation of posting rules.
Configure a new parameter set to control the processing parameters for import of bank statement. You can use t-code S_ER9_11001563 or maintenance view VC_FAR_BSIMP_PSETS (via SM34) to configure it. Relevant configuration activity is also available under the following menu path:
SPRO → Financial Accounting → Bank Accounting → Business Transactions → Payment Transactions → Electronic Bank Statement → Define Parameter Sets.
Apart from these configuration activities, implement BADIs FIEB_GET_BANK_STMTS_X & FIEB_MAPPING_X as described in my previous post.
Fiori-specific enhancements for custom bank statement format
If you maintained baseline configuration for custom bank statement format as described above, you can attempt to upload bank statement via Fiori App F1680 “Manage Incoming Payment Files”. However, the app will throw an error message “No implementation was selected for the current BAdI. An exception was raised”. Unfortunately, the error message does not provide further details e.g., what BAdI was not implemented.
Implement BADI FAR_IPF_FORMAT_RECOGNITION to address this exception. The filter value for this enhancement should be the same as configured in view VFIEB_MAPP_XCTRL.
data lv_bank_statement type string.
call function 'LXE_COMMON_XSTRING_TO_STRING'
in_xstring = iv_bank_statement
ex_string = lv_bank_statement
error = 1
others = 2 .
if sy-subrc <> 0.
split lv_bank_statement at cl_abap_char_utilities=>cr_lf into table data(lt_csv_lines).
if sy-subrc = 0.
rv_is_compliant = abap_true.
Implement the second BADI FAR_IPF_NUMBER_OF_STATEMENTS to calculate the number of bank statements per payment file. Note this BADI uses combination of two values for the filter purposes:
- FILE_FORMAT should be “X” (i.e., bank specific format as explained above).
- Format ID from view VFIEB_MAPP_XCTRL should be indicated as FILE_FORMAT_LONG.
Personal opinion: I was a bit confused by these BADI filters and do not fully understand why SAP uses different filter values for these two BADIs. But at least it is working as advertised.
Depending on the complexity of your bank statement, you can implement this BADI differently. If your bank always provides only one bank statement per file, the logic of this BAdI will be very easy:
However, if you bank provides more than one bank statement per file, you will need to implement more complicated logic. Here is a baseline source code that allows you to fetch the binary data of the payment file and transform it into a text table. Once you have a text table, you can implement your own logic to parse it and decide how many statements it contains.