Symptom or Issue
When we are trying to create a business partner or vendor registration or supplier registartion from Ariba Network for a bank account that is greater than 18 digits we get an error in the payload because in SAP ECC Bank account number field is of 18 characters only.
Error Message
Error for mapping BPBUPA_RPLRQ_BSFND_IN step BANKDETAILS
Data loss on copying of MDG_BP_BPSUITERPLCT_REQ_BK_DET-BANK_ACCOUNT_ID to BUS_EI_STRUC_BANKDETAIL-BANK_ACCT: Source 15191234567891011121314, target 151912345678910111
Other Terms
As explained in the SAP note -
https://launchpad.support.sap.com/#/notes/1585003 the maximum number of characters allowed for the bank account is 18 characters and if the account number is more than 18 characters for countries like Poland, Russia, etc then ERP/ECC/HANA expects account number in a different format where reference fields are expected.
In Ariba, there is no limitation on account number as 18 characters hence you have to customize these fields such that for certain countries account numbers will pass only 18 characters, and the remaining data will be passed under reference fields using visibility conditions being set on the country is selected.
With the Bank component feature which uses bank account as answer type and we will not have the option to customize these fields, if suppliers connected are from a different region then the idea of using bank mapping with Text as answer type and applying visibility condition would be the best choice.
This is the system design and limitation and due to the database design and technical limitations, it's not possible to extend the length of domain BANKN into CHAR35.
If the account number of few countries is larger than 18 Characters then reference fields have to be used. You can use a visibility condition that if countries like Poland, China, Spain, France, etc are selected then based on the fields defined in the note, the questions with the respective field, the mapping should populate and supplier should provide a response to these fields
Solution
I am aware that this solution can be achieved by creating the additional questionnaire field, or by keeping validation or using visibility conditions in the supplier Questionnaire. This blog is written for Technical consultants who want to achieve this solution using ABAP Development.
STEP1
We have implemented the BADI
MDG_SE_BP_BULK_REPLRQ_IN and using the
method IF_MDG_SE_BP_BULK_REPLRQ_IN~INBOUND_PROCESSING
STEP2
Identify if the Bank Account No. is greater than 18 Digits
LOOP AT in-business_partner-bank_details INTO DATA(ls_item3).
IF ls_item3-bank_account_id IS NOT INITIAL.
DATA(lv_bank_length) = strlen( ls_item3-bank_account_id ).
IF lv_bank_length GT 18.
DATA(lv_bank_length_final) = lv_bank_length - 18.
ENDIF.
ENDIF.
ENDLOOP.
STEP3
When bank account no. is greater than 18 Digits there is a standard error of BUPA data loss (Refer to the error message in symptom) when copying, removing this error using the below code of block
IF lv_bank_length_final IS NOT INITIAL.
CALL METHOD in_message_container->remove_message
EXPORTING
iv_type = 'E'
iv_id = 'SMT'
iv_number = '151'.
CALL METHOD in_message_container->remove_message
EXPORTING
iv_type = 'E'
iv_id = 'SMT'
iv_number = '048'.
ENDIF.
STEP4
Add the account number to the reference field from the 18th position
LOOP AT out-partner-central_data-bankdetail-bankdetails INTO DATA(ls_item4).
IF lv_bank_length_final IS NOT INITIAL.
ls_item4-data-bank_ref = ls_item3-bank_account_id+18(lv_bank_length_final).
ls_item4-datax-bank_ref = abap_true.
MODIFY out-partner-central_data-bankdetail-bankdetails FROM ls_item4 INDEX sy-tabix TRANSPORTING data-bank_ref datax-bank_ref.
ENDIF.
ENDLOOP.
STEP5
Now there are two cases (Please note that below twp code blocks are mandatory to make this logic work end-to-end:
- In the case of the existing supplier, when the Bank account is greater than 18 Digits, we need to update the bank account number we need to write below code of block to change the object task from I (Insert) to U (Update) so that the already existing supplier bank account details can be updated
IF lv_bank_length_final IS NOT INITIAL AND out-partner-header-object_task = 'I'.
IF out-vendor-header-object_instance-lifnr IS NOT INITIAL AND out-vendor-header-object_task = 'U'.
out-partner-header-object_task = 'U'.
ENDIF.
ENDIF.
- In the case of New supplier creation when the Bank account is greater than 18 Digits, GUID is blank we need to update the GUID without any special characters
DATA:lv_guid TYPE char149.
CLEAR:lv_guid.
IF lv_bank_length_final IS NOT INITIAL AND out-partner-header-object_task = 'I' AND out-vendor-header-object_task = 'I'.
lv_guid = in-business_partner-uuid-content.
REPLACE ALL OCCURRENCES OF '-' IN lv_guid WITH space.
CONDENSE lv_guid.
CALL FUNCTION 'ISP_CONVERT_FIRSTCHARS_TOUPPER'
EXPORTING
input_string = lv_guid
separators = ' -.,;:'
IMPORTING
output_string = lv_guid.
out-partner-header-object_instance-bpartnerguid = lv_guid.
ENDIF.
Conclusion
Now we can integrate Suppliers or Vendors from Ariba Network without any error to the SAP ECC system who are having Bank account numbers greater than 18 Digits.
Thanks for reading this blog post.
Please correct me if mistaken at some point, also suggest improvement points.
I hope this blog post will be helpful. If you have questions/suggestions/issues about this, please feel free to leave them in the comments section.
I would like to see your comments and would like to answer questions which you can post at Q&A tag area:
https://answers.sap.com/tags/66233466-fcd6-45d2-a9ae-2cba38c72e19