bodsexpert
bodsexpert

Working with IDocs in BODS

By Imran, Mohammad January 31, 2022 under BODS

 

IDoc is one of loading methods available which is supported by BODS, This is widely used in SAP implementation project if BODS is used as a Migration tool. Others tools are also available such as LSMW and LTMC(Applicable in only S4HANA) but BODS along with IDoc is more feasible as it supports parallel processing, less manual activities and much faster than LSMW and LTMC. In this post we are going to see how we can design the query to load data in SAP ECC or S4HANA using BODS and IDoc. Functional Location object is taken as an example to demonstrate you.

 

Query Design

IDoc design

IDoc query design is based on IDoc structure, so you first need to analyze the structure of IDoc and check the segments you will need for your data load.
As you see below IDoc structure has many segments but I need only those which are in scope for my data load. So I considered E1FUNC_LOC_CREATE, E1BP_ITOB and E1BP_ITOB_FL_ONLY.
EDI_DC40 will be a default segment which contains partner profile config data. Check the partner profile setting up here.

IDoc design

Step 1 - Data Preparation

Prepare a table which will store the data for those segments. You can get the list of fields from IDoc structure or check the requirement gathering document. map all fields and apply the joining conditions between the tables used in functional location - You can check the post here to know about tables and joining conditions used in a particular object.
In the example below all required source tables are joined in order to get a final table which will store all the fields so that we can distribute them in the IDoc segments.

Parallel Processing

Step 2 - IDoc fields mapping

1. Create query transform for every Segments map the required fields. IDoc segments can have many fields which may not be required so you can leave them mapping null.
2. Segments which are not required can be deleted from the query transform.
3. Right click on the segment and make current then map the fields from the corresponding segment from input schema.

IDoc Design

Step 3 - FROM Clause

Make sure segments of input schema corresponding to right output schema.
1. Every IDoc will have header segment, in this case E1FUNC_LOC_CREATE is header segment which will point to QRY_EDI_DC40.
2. Your top most segment which will come by default when you connect your query transform, in this case QRY_LOAD_IDOC has been created which will point to header segment which is E1FUNC_LOC_CREATE.
3. Rest which are EDI_DC40 and and child segment will point to its corresponding segment. In the example below you understand how FROM clause has been modified. Make sure the segment you want to work on is made current, to do that click right and make current

Make current top most segment and choose header segment from FROM tab.

IDoc Design

Make current header segment segment and choose EDI_DC40 segment from FROM tab.

IDoc Design

Make current EDI_DC40 segment segment and choose EDI_DC40 segment from FROM tab.

IDoc Design

Make current other child segments and choose their respective child segment from FROM tab.

IDoc Design

Step 4 - WHERE Clause

Where clause becomes very important when you have one or more than one child segment. You need make a connection between header and child segment so that IDoc can corelate the header data with item data based one the key field that you will apply in Where clause.

E1BP_ITOB and EIBP_ITOB_FL_ONLY are the child segments so they should be joined with their header segment which is E1FUNC_LOC_CREATE.
EXTERNAL_NUMBER is key field which has been used in joining condition. Key field can be more than one so they all should be in joining condition by AND or OR operator.

IDoc Design

Step 5 - Query EDI_DC40

You need to look for the partner profile setup to get all these details, if you are not sure connect with Basis team for the details. You cannot execute IDoc if setting is not correctly entered in EDI_DC40 query transform. Below is the example to give you an idea how you can enter the details but this will be different from project to project.

IDoc Design
IDoc Design

Execute the job

Final step is to execute the job and check the IDoc status. IDoc has mostly 4 kinds of statuses.
1. 56 - it occurs when partner profile does not exist, missing or has any issue.
2. 51 - it occurs when you have data related issue which does not meet with SAP requirements.
3. 64 - it occurs when the Partner Profile setup is made as Background Processing or something is stopping it internally. You should process it through BD87 or any Parallel processing program. Click on the links to see how they work in SAP.
4. 53 - it displays when you do not have any issue and your IDoc is successfully posted. You can check in SAP table that the records is created.

IDoc Design

Conclusion

So you have seen how we how we schedule a batch job to execute parallel processing program to to turn to your IDocs from 64 to 53. You will see significant improvement in your IDoc processing.