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: 
Former Member
This is the first time I am writing any blog in my life, so please bear in case its not in a structured manner. :wink:
Pre requisite: The reader should be aware of the use of Search strings in the Electronic bank statement (preferable MT940 file format).
A couple of years back when I started learning the configurations of Electronic bank statement, I bumped into this sap node in the SPRO path called, " Define Search String for Electronic bank Statement". I was amazed with the use of this functionality and the power it provides to the functional consultant to meet the basic requirements with no involvement of ABAP developer.
While going through the SAP help document for this node I found various usage of this search string and how we can populate the required value in the target fields of any accounting document. There are some basic frequently used fields like cost center, profit center which are provided as default target fields in configuration step of 'Search string use'. In case the required field is not available then you can use the option of BDC fields as the target field.
While reading the details on the use of BDC fields in the help document (see below snapshot) I realize that it only talks about identifying a string of data from the Bank statement and then passing a fixed value to the required BDC field.
But, then I asked myself, " What if my data in the file is not the same always and I need to get this dynamically varying data from the bank statement to fill the same BDC field?".
Do I need to create 'n' number of search strings based on each value that appears in the bank statement? or Is there any other option?
Eureka!! :smile:
After a few trial and error methods, I found the below solution or work around or whatever you would like to call it out.. :wink:
Lets take a scenario that based on some identifiers appearing in your bank statement, you need to populate the Reference key 3 (XREF3) field of the accounting document with some data from the bank statement itself.
Lets assume we are using MT940 file format for the Electronic bank statement and below is a sample data of tag 61 and tag 86.
Now, in the above example we are doing some FOREX transactions (like hedging) with the bank for which the reference contract number is as highlighted above. If we want to populate this contract number in the XREF3 field or another field of the SAP accounting document then we can do it with the below trick :wink: ,
Assumption: the contract number (length 6 digits) always follows after /SR/CONTRACTXXXXXX in the tag 86 of the file. This acts as an identifier for us. In case you are not able to identify a fixed value then you can consult with your respective bank or ask them to add a fixed identifier before the required data.
Step 1: Define first search string say 'String1'
Srch strg name: String1
Description: Identify data sequence from the file.
Search string: /SR/CONTRACT######
Mapping: empty, empty.... empty (i.e. you need to keep the mapping value as empty).

Step 2: Define another search string say 'String2' whose search string definition is same as the first one but with slight change in the mapping value.
Srch strg name: String2
Description: Getting the contract number from the file.
Search string: /SR/CONTRACT######
Mapping: empty, empty.... empty,#,#,#,#,#,# (i.e. you need to only map the # digits as it is and rest keep it empty).
Step 3: Assign the Search String 'String1' defined in step 1 to the correct target fields.
In this step add your required details like company code, house bank, account ID, etc. with Search string as 'String1', corresponding target field as 'BDC field name 1’ and in the Mapping Prefix enter the field name i.e. BSEG-XREF3 in our case.
Step 4: Assign the Search String 'String2' defined in step 2 to the correct target fields.
In this step add your required details like company code, house bank, account ID, etc. with Search string as 'String2', corresponding target field as 'BDC field value 1’. The Mapping Prefix field will be blank in this case as the value would be determined from the file itself based on the search string definition.

That's it you are ready to dynamically get the value from the file. :smile:

Didn't you realize the trick.. :wink:  
No... :smile: well below is the explanation,

In case you read the SAP help document (see the first snapshot) then it asks to maintain the target field as 'BDC field name 1' and 'BDC field value 1' for the same search string and thus we are only able to pass a fixed value via mapping prefix to the BDC field of the accounting document.

In my case, we define two search string which is having the same definition but different mapping rule. Here, the first search string is used to identify the sequence in the tag 86 of the bank statement and if its successful then it will fill the target field 'BDC field name 1' with BSEG-XREF3 (as per our example). While the second search string (having the same definition) will be used to identify the dynamic value from the file and then to fill the target field 'BDC field value 1'  as 'XXXXXX' (from the file) i.e. value for the BDC field BSEG-XREF3.

As the definition of both the search string is same, then either both will be successful or both will be failed. There won't be any case were either of them is successful and this is the Trick :wink: which I have used to identify the BDC field name with first search string and then the BDC field value with the second search string.

This really works. Try it out and let me know your results :smile:

Please share your suggestions, corrections or any other pointers in the comments section.

Thanks again for reading this blog :smile:

Disclaimer: The above work around mentioned is based on my personal experience and is not copied or referred from anywhere else.

Labels in this area