Understanding SAP ERP Nested Structures and Nested Tables

SAP ERP Remote Function Modules can contain several types of parameter lists. The term parameter is used to name a variable, and to refer to one of the pieces of data provided as input to the function. All SAP ERP Remote Function Modules are strongly typed, which means that the types of data that can be passed to the parameters is defined beforehand in the definition of the function. A parameter list is grouped by the kind of parameter or direction. A function has the following types of parameter lists:

Exceptions: Some functions have strongly typed exceptions. These are not part of the schema, but will be formally generated by the function in the event of an error (in the form of ABAP Exception), with an error key and value.

The iWay Application Adapter for SAP ERP provides the following modes of operation:

A Remote Function Call (RFC) can be defined with parameters defined as optional or mandatory. If a parameter is optional and no value is passed, then the parameter is marked as inactive. If a parameter is mandatory, then the function cannot be called until a value has been assigned to the parameter.

All data is passed to and from Remote Function Modules by value, which means that the actual values are sent along with the call.

All parameters must be defined with the data types that are defined in the SAP ERP Data Dictionary. The caller of the function can call this dictionary to find the types of the parameters, and then pass the appropriate values.

These are the ABAP data types that are defined as elementary and complex, and their usage helps define the parameter type as well as the data type. The available elementary types are:

Numeric:

Character:

Byte:

Complex data types are built from the elementary types and are defined in the SAP ERP Data Dictionary as:

The following data types handle variable length records:

Using STRING or XSTRING in a function parameter causes the function to run more slowly over RFC, as the data must be converted to XML, shipped over the transport, and then converted back to the data type. Using STRING or XSTRING or a Table in a Structure makes the Structure a Deep Structure.

In SAP ERP, the use of IMPORT and EXPORT parameters was limited to elementary data types or Structures. With the latest releases of SAP ERP ECC, the ability to allow any data type in any of the parameter lists has been added. Now, an IMPORT parameter can contain a Table just as it can contain an elementary type.

Flat Structures contain only elementary data types with a fixed length (no internal Tables or strings).

Nested Structures

A Structure can contain a column that is itself a Structure or a Table. This makes the Structure a Nested Structure. If any of the elements contain a variable length element or Table, then it becomes a Deep Nested Structure.

The following is a sample XML structure of a Nested Structure:

<REQHDR>
      <MESSGID/>
      <TMSTP/>
      <CORRID/>
      <CONSID/>
      <PROVID/>
      <TRINFO/>
             <TRACK>
                   <ZBUSID/>
                   <ZCONVID/>
                   <ZUSERID/>
             </TRACK>
</REQHDR>

The Structure REQHDR has a column called TRACK that is itself a Structure.

The following is a sample XML structure of a Deep Nested Structure:

<SYSTEMINFO>
      <FDPOS/>
      <COLNO/>
      <DTSTRING/>
            <SYST2>
                  <STINFO/>
                  <TABIX/>
                  <TFILER/>	
            </SYST2> 
<SYSTEMINFO>

The Structure SYSTEMINFO has a string called DTSTRING and a Structure called SYST2.

A Table can contain an elementary type, consist of elementary types, or contain Nested Structures and Tables.

The following list provides the combinations of types that are possible:

The following is a sample XML structure of a Nested Table:

<INBOUNDINFO>
<_-SAPCND_-SRMA__LIN>
                <item>
                      <CLIENT/>
                      <SCALE_ID/>
                      <SCALE_LINE_ID/>
                      <NUM_FLIGHTS/>
                      <DBACTION/>
                </item>
</_-SAPCND_-SRMA__LIN>
<_-SAPCND_-SRMDEF>
                <item>
                      <CLIENT/>
                      <SCALE_ID/>
                      <SCALE_BASE_TYPE/>
                      <SCALE_TYPE/>
                      <DBACTION/>
                </item>
</_-SAPCND_-SRMDEF>

The iWay Application Adapter for SAP ERP supports all of these types, except for a Nested Table whose type (definition) is itself a line type. This is supported on request only because of the complexity of the Structure.


iWay Software