ABAP- Hybris Impex program
My company is implementing Hybris version 220.127.116.11 together with SAP ECC 6.0 for building a b2b/b2c eCommerce portal.
Though custom RFCs are created for real-time calls to SAP data like ATP, CDQ, order creation etc., we tried using datahub for asynchronous customer master and product master loads.
But there is a very intolerant performance issue with a business requirement of time critical customer master sync from SAP to Hybris.
When the customer signs up to use the ecommerce portal, his customer master as entered during registration from Hybris portal has to be saved/verified in the Active Directory(AD) and SAP and has to be updated back to Hybris on successful verification. The whole cycle has to be complete before the customer logins in after registration.
We were not able to achieve this on the expected time using the Datahub version 5.5 and SAP ECC 6.0.
I would like to share my solution for real quick customer master transfer from SAP to Hybris.
The integration between Datahub and SAP is using IDOCs.
DEBMAS, ADRMAS, and ADR3MAS IDOCs are used to send every detail of customer master including partner and contact details.
Datahub parses every field in every segment of the IDOCs and goes through a series of composition and publication process to create the impex file that is used to upload the data into the appropriate types in Hybris.
The DEBMAS, ADRMAS, ADR3MAS IDOCs ultimately update B2BUnit, B2BCustomer and Address types in Hybris.
Understanding the processes in the Datahub, I have created an ABAP program that will read the SAP database tables and generate the impex files directly.
This way we bypass the IDOCs and Datahub and connect the SAP and Hybris Databases using a more powerful ABAP means.
The program design is,
1. To read the customer master tables including,
KNA1 – General data
KNB1 – Company code data
KNVP – Partner data
KNVV – Sales area data
KNVK – Contact persons data
ADR6 – Email Addresses
2. Then create inline impex headers and corresponding coma separated customer master data to update the B2BUnit, B2BCustomer and Address types in Hybris.
B2BUnit has all the customer master data.
Address has all the customer addresses and links the partners to the customer
B2BCustomer is used to store the contact person details.
The impex file is a .csv file that is written to an SAP application server file that is mounted on the Hybris hot folder.
As soon as the file is written to the hot folder, they are picked for execution and immediate database update is achieved.
As the Hybris hot folder approach starts execution as soon as the impex file is written and before it is completely written, it is a good idea to place it in a staging folder until it is completely written and move it to the actual hot folder for execution.
I have herewith attached a sample impex file and my program.
The program includes logic to do,
– new customer transfer from Hybris to SAP
– transfer changes to master data
– transfer delinking of partners from customer