bodsexpert
bodsexpert

Working with IDocs in BODS

By Imran, Mohammad January 31, 2022 under BODS

 

IDoc is one of the data loading methods supported by SAP BusinessObjects Data Services (BODS). It is commonly used in SAP implementation projects where BODS is utilized as the data migration tool. While alternative tools such as LSMW and LTMC (applicable only to S4HANA) are also available, the combination of BODS and IDoc is often considered more efficient. This method supports parallel processing, involves less manual effort, and delivers faster performance compared to LSMW and LTMC.

In this post, we will explore how to design a query to load data into SAP ECC or S4HANA using BODS and IDoc. The Functional Location object will be used as an example to demonstrate the approach.

 

Query Design

IDoc design

IDoc query design is based on the structure of the IDoc itself, so the first step is to analyze the IDoc structure and identify the segments required for your data load.
As shown below, the IDoc structure contains multiple segments, but you only need to include those relevant to your specific data load. In this example, the segments E1FUNC_LOC_CREATE, E1BP_ITOB, and E1BP_ITOB_FL_ONLY are considered.
The EDI_DC40 segment is a default segment that contains partner profile configuration data. Click here to learn how to set up the partner profile.

IDoc design

Step 1 - Data Preparation

Prepare a table that will store the data corresponding to the required IDoc segments. You can obtain the list of fields either from the IDoc structure or from the requirement gathering document. Ensure that all fields are properly mapped and apply the necessary join conditions between the tables used for the Functional Location object. You can refer to this post to learn more about the tables and join conditions used for a specific data migration object.
In the example below, all relevant source tables are joined to create a final table that consolidates all the required fields. This consolidated data will then be distributed into the respective IDoc segments.

Parallel Processing

Step 2 - IDoc Fields Mapping

1. Create a Query Transform for each IDoc segment and map only the required fields. IDoc segments often contain many fields, but you can leave unnecessary ones unmapped (set them to null).
2. Segments that are not needed for the data load can be removed from the Query Transform.
3. Right-click on the segment and select Make Current, then map the corresponding fields from the input schema to the appropriate segment.

IDoc Design

Step 3 - FROM Clause

Ensure that the segments in the input schema are correctly mapped to the corresponding segments in the output schema.
1. Every IDoc includes a header segment. In this case, E1FUNC_LOC_CREATE is the header segment, which should point to QRY_EDI_DC40.
2. The topmost segment, which is created by default when you connect your Query Transform—in this case, QRY_LOAD_IDOC—should point to the header segment, E1FUNC_LOC_CREATE.
3. All other segments, including EDI_DC40 and child segments, should point to their corresponding segments as defined in the structure.
In the example below, you can see how the FROM clause has been modified to reflect these relationships. Make sure the segment you want to configure is set as the current segment—right-click on it and select 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

The WHERE clause is critical when working with one or more child segments. It establishes the connection between the header and child segments, allowing the IDoc to correlate header data with item-level data based on key fields defined in the condition.

In this case, E1BP_ITOB and E1BP_ITOB_FL_ONLY are child segments that need to be joined with their parent header segment, E1FUNC_LOC_CREATE.
The field EXTERNAL_NUMBER is used as the key for the join condition. If there are multiple key fields, all should be included in the WHERE clause using the AND or OR operator, as appropriate.

IDoc Design

Step 5 - Query EDI_DC40

Refer to the partner profile setup to obtain the necessary details for this step. If you are unsure about the configuration, consult the Basis team for assistance. The IDoc will not execute successfully if the settings are not correctly entered in the EDI_DC40 Query Transform.
The example below provides a general idea of how to enter these details; however, please note that the configuration may vary depending on the specific requirements of your project.

IDoc Design
IDoc Design

Execute the Job

The final step is to execute the job and verify the IDoc status. IDocs generally return one of the following four statuses:
1. 56 – This status indicates that the partner profile does not exist, is missing, or has a configuration issue.
2. 51 – This occurs when there is a data-related issue, such as invalid or missing information that does not comply with SAP requirements.
3. 64 – This status appears when the Partner Profile is set to Background Processing, or when something internal is delaying the IDoc. In such cases, process the IDoc using Transaction BD87 or an appropriate parallel processing program. Click the links for more details on these processes.
4. 53 – This status confirms successful posting of the IDoc. You can verify that the corresponding record has been created in the relevant SAP table.

IDoc Design

Conclusion

In this post, we have demonstrated how to schedule a batch job to execute a parallel processing program, transforming your IDocs from status 64 to 53. By following these steps, you will see a significant improvement in your IDoc processing efficiency.