Skip to Content

While data migration, sometimes we come across requirements which need BDC programs to be developed to upload the data in Mass, but sometimes even BDC program or LSMW recording is not feasible like in case of Customer Hierarchy (VDH2N) Transaction.

Oops Problem!!

 

In such cases we have following options:

  • Look for BAPI or Functional Module and use that BAPI in LSMW.

 

         image

 

  • In case of functional module create a custom program using it or create a wrap around BAPI to use in LSMW. Lot of effort and CTS is required to develop and transport the code to different SAP Systems (Testing, Quality, Production).

 

In case we have a standard BAPI available and is associated with a business object life is easy, otherwise… Sounds Tough Right!!!

 

In this blog we will discuss a third and easy method to create an upload program for Customer Hierarchy Mass creation without creating a custom program or wrap around BAPI.I used the BAPI “BAPI_CUSTOMER_HIERARCHIE_INS” but differently. Exciting, isn’t it?

 

Let’s start step by step.

  • Create an LSMW Program with dummy recording for any transaction, just to complete the first step or use any already existing recording. Basically we are not going to use this recording after this step.

 

          image

 

  • Create the source structure and the source fields as shown below. Make sure that all the below shown fields are maintained in structure as they are required to create customer hierarchy.

 

         image     

 

  • Now, inside “Field Mapping and Conversion” step write a code under the processing area “End _Of_Record” using BAPI “BAPI_CUSTOMER_HIERARCHIE_INS” as shown below. Use “End_Of_Record” processing area as it is processed at the end of each input record.

 

         image

 

  • Code can be modified as per the output requirement.
  • The input file format need to have the fields as shown below.

 

          image

 

  • Specify the input file location in LSMW.
  • Execute the data read step and check if the data is read properly from the file.

 

          image

 

  • Now when “Convert Data” step is executed, the code is processed record by record and customer hierarchy got created. I have coded to display the error customers in output. So, if any record is failed due to any reason the corresponding customers will be displayed on screen after execution of all records in file.

 

We are done with the Customer Hierarchy creation and no further LSMW Steps need to be processed.So, this way we can handle such situations where recording is not possible and don’t have enough time to create custom programs to Mass upload.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply