Table of Contents

Search

  1. Preface
  2. Part 1: Getting Started with PowerExchange for SAP NetWeaver
  3. Part 2: Data Integration Using PowerExchange for SAP Dynamic ABAP Table Extractor
  4. Part 3: Data Integration Using ABAP
  5. Part 4: IDoc Integration Using ALE
  6. Part 5: Data Integration Using BAPI/RFC Functions
  7. Part 6: Data Migration
  8. Part 7: Business Content Integration
  9. Part 8: SAP BW Data Extraction
  10. Part 9: Loading Data to SAP BI
  11. Appendix A: Data Type Reference
  12. Appendix B: Code Pages and Unicode Support
  13. Appendix C: Glossary

PowerExchange for SAP NetWeaver User Guide for PowerCenter

PowerExchange for SAP NetWeaver User Guide for PowerCenter

IDoc Primary and Foreign Keys

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 IDoc Prepare transformation 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 IDoc Prepare transformation groups incoming IDoc data based on the values in the primary and foreign key fields. The Control Input group of the IDoc Prepare transformation represents the parent segment. All other groups of the IDoc 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 IDoc Prepare transformation and the fields used for the primary and foreign keys:
Group(s)
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 IDoc 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.

0 COMMENTS

We’d like to hear from you!