Adding leading zeroes to the Vendor ID credentials
By default the BSAO Adapter sends cXML messages with the Vendor ID as displayed on SAP systems. Without leading leading zeroes when the Vendor ID is a number.
Internally, at the database level, the Vendor ID is saved with leading zeroes (on numeric values) due to a alphanumeric conversion that occurs on he system.
If we are using only Ariba’s Document Automation or Supply Chain Collaboration solutions, we do not have any problem normalizing the Vendor ID data. When enabling Suppliers on the Ariba Network, All the numeric Vendor IDs will be assigned to the Suppliers AN accounts without leading zeroes. As they are sent by the BSAO adapter.
However, if we there are other Ariba Solutions in scope, such as Procurement and Invoicing (P2P), Invoice Management (InvoicePro), or Sourcing; we ran into a mismatch with the Vendor ID data.
That is because these Ariba solutions consider the Vendor ID data as it is stored in the database. That means that numeric Vendor ID records will have leading zeroes on them up to 10 charactes long.
i.e. Vendor ID “11” will be exported as “0000000011”
This happens with the Vendor Master Data extractors from SAP to Ariba, as well as the Transactional data flowing between SAP and Ariba (P2P and Sourcing).
In order to normalize the Vendor ID data across Ariba Solutions, we have a few strategies:
- Customize the BSAO Adapter interfaces to add the leading zeros into the Vendor ID credential
- Customize the Vendor master data extractor and transactional interfaces between SAP and Ariba (P2P and Sourcing)
- Use the Ariba Network Supplier ID (ANID) as the reference in P2P and SAP
Usually the option 1. is preferred way as it has less points of customization, and no extra maintenance needed by the customer. This is the option that I’m explaining bellow.
On each of the Outbound interfaces that are in scope for the project, implement the corresponding Outbound mapping method of the ARBERP_OUTBOUND_MAPPING BAdI.
If you have Purchase Order, Goods Receipt and Invoice Status Update is scope, you will need to implement this code change in each those mapping BAdI methods.
To make it more efficient, I suggest creating a Static method of function module to keep the core logic of adding the leading zeroes to the To Credentials and then calling this code in each of the outbound mapping BAdIs implementations.
Adding the leading zeroes to the Vendor ID and Private ID credentials
FIELD-SYMBOLS <ls_vendor> TYPE ARBERP_XORDR_S_CREDENTIAL. DATA lc_vendor TYPE LIFNR. * Changing the Vendor ID READ TABLE TO_CREDENTIAL WITH KEY DOMAIN = IF_ARBFND_CXML_CRED_DOMAIN_C=>GC_VENDORID ASSIGNING <ls_vendor>. IF <ls_vendor> IS ASSIGNED. lc_vendor = <ls_vendor>-IDENTITY-CONTENT. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = lc_vendor IMPORTING OUTPUT = lc_vendor. <ls_vendor>-IDENTITY-CONTENT = lc_vendor. UNASSIGN <ls_vendor>. ENDIF. * Changing the Private ID READ TABLE TO_CREDENTIAL WITH KEY DOMAIN = IF_ARBFND_CXML_CRED_DOMAIN_C=>GC_PRIVATEID ASSIGNING <ls_vendor>. IF <ls_vendor> IS ASSIGNED. lc_vendor = <ls_vendor>-IDENTITY-CONTENT. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING INPUT = lc_vendor IMPORTING OUTPUT = lc_vendor. <ls_vendor>-IDENTITY-CONTENT = lc_vendor. UNASSIGN <ls_vendor>. ENDIF.
Calling the code to add the leading zeroes from the Mapping BAdI
i.e. here is the PO outbound mapping method ARBERP_OUTBOUND_MAPPING->MAP_BUS2012_TO_ORDR_OUT
method IF_ARBERP_BADI_OUTB_MAP~MAP_BUS2012_TO_ORDR_OUT. * Adding the leading zeroes to the Vendor ID and Private ID credentials CALL METHOD ZCL_ARBERP_MAP_OUT=>VENDOR_LEADING_ZEROES CHANGING TO_CREDENTIAL = CS_ORDR-HEADER-TO-CREDENTIAL. endmethod.
With the above code change in place, the cXML output for the Outbound messages should have teh leading zeroes on the Vendor ID and Private ID.