SAP Connector Guide > Part VI: Data Integration Using IDocs > IDoc Mapplets > Inbound Mapplet
  

Inbound Mapplet

You can synchronize transactional data in a legacy application with the data in the SAP application database.
Use an inbound SAP IDoc mapping to send the transactional data from the legacy application database to the SAP system. Informatica Cloud extracts the data from the legacy application data source, prepares the data in SAP IDoc format, and sends the data to the SAP system as inbound IDocs using ALE. You can use the IDoc Writer connection to write inbound SAP IDoc messages to SAP systems.
To generate the inbound mapplet to write IDocs to SAP systems, use the Prepare transformations when you import the IDoc metadata. Import the inbound mapplet to Informatica Cloud and configure an inbound mapping.

IDoc Primary and Foreign Keys

An IDoc message is organized hierarchically with one top-level parent segment and one or more second-level child segments. Second-level child segments can also have one or more third-level child segments.
To maintain the structure of the IDoc data, the Prepare transformation in the SAP IDoc Writer mapplet uses primary and foreign keys. The top-level parent segment has a primary key. Each child segment has a primary key and a foreign key. The foreign key of each child segment references the primary key of its parent segment. For example, the foreign key of a second-level child segment references the primary key of the top-level parent segment. Similarly, the foreign key of a third-level child segment references the primary key of the second-level child segment.
The Prepare transformation groups incoming IDoc data based on the values in the primary and foreign key fields. The Control Input group of the Prepare transformation represents the parent segment. All other groups of the Prepare transformation except the ErrorIDocData group represent second-level or third-level child segments. The ErrorIDocData group is used for processing invalid IDocs.
The following table shows the groups of the Prepare transformation and the fields used for the primary and foreign keys:
Groups
Field
Description
Control Input Group
GPK_DOCNUM
Primary key of the parent segment.
Child Segment 1
GPK_<Child1_name>
Primary key of Child Segment 1.
Child Segment 1
GFK_DOCNUM_<Child1_name>
Foreign key of Child Segment 1 references the primary key of the parent segment.
Child Segment A of Child Segment 1
GPK_<Child1A_name>
Primary key of Child Segment A of Child Segment 1.
Child Segment A of Child Segment 1
GFK_<Child1_name>_<Child1A_name>
Foreign key of Child Segment A of Child Segment 1 references the primary key of Child Segment 1.
Child Segment 2
GPK_<Child2_name>
Primary key of the IDoc child segment.
Child Segment 2
GFK_DOCNUM_<Child2_name>
Foreign key of Child Segment 2 references the primary key of the parent segment.
Child Segment B of Child Segment 2
GPK_<Child2B_name>
Primary key of Child Segment B of Child Segment 2.
Child Segment B of Child Segment 2
GFK_<Child2_name>_<Child2B_name>
Foreign key of Child Segment B of Child Segment 2 references the primary key of Child Segment 2.
Each value for the GPK_<name> field needs to be unique. Each GFK_<parent_name>_<group_name> field needs to reference the primary key of its parent segment.
For example, the following table shows the relationship of primary and foreign keys in an IDoc message named ABSEN1 with four child segments:
Group
Field
Primary/Foreign Keys
CONTROL_INPUT_ABSEN1
GPK_DOCNUM
P1
E2ABSE1
GPK_E2ABSE1
C1
-
GFK_DOCNUM_E2ABSE1
P1
E2ABSE2
GPK_E2ABSE2
C2
-
GFK_DOCNUM_E2ABSE2
P1
E2ABSE2A
GPK_E2ABSE2A
C2A
-
GFK_E2ABSE2_E2ABSE2A
C2
E2ABSE3
GPK_E2ABSE3
C3
-
GFK_DOCNUM_E2ABSE3
P1
E2ABSE3B
GPK_E2ABSE3B
C3B
-
GFK_E2ABSE2_E2ABSE2A
C3
E2ABSE4
GPK_E2ABSE4
C4
-
GFK_DOCNUM_E2ABSE4
P1
The Prepare transformation uses these primary and foreign key relationships to maintain the structure of the IDoc data. Any foreign key field that does not match the primary key of its parent segment results in an orphan row. Any primary key field that is not unique results in a duplicate row.
Verify that each IDoc message has a unique primary key for the top-level parent segment, each child segment, and that each foreign key matches the primary key of its parent.