Using Table data types for SAP web services

SAP web services can require a Table data type as an input or output parameter. An SAP table is similar to a database table composed of columns, where each row in the table represents a record.

AEM forms uses a list of map values to represent an SAP Table:

  • The list value represents the table.

  • Each map value represents a row in the table.

  • The map key is the name of the table column. The corresponding string value is the value for that column.

For example, an SAP table has the columns COL1, COL2, and COL3. The SAP web service requires two rows of table data as a value for the INPUT_TABLE input parameter. You create two map variables that contain string values: varMap1 and varMap2. You use the Set Value service to set the values in each map, using entries that are similar to the following expressions:

/process_data/varMap1[@id='COL1'] = 'value1' 
/process_data/varMap1[@id='COL2'] = 'value2' 
/process_data/varMap1[@id='COL3'] = 'value3' 
/process_data/varMap2[@id='COL1'] = 'valueA' 
/process_data/varMap2[@id='COL2'] = 'valueB' 
/process_data/varMap2[@id='COL3'] = 'valueC'

You also create a list variable named SAPtable. You use the Set Value service to add the map values to the list:

/process_data/SAPtable=varMap1 
/process_data/SAPtable=varMap2
Note: When no index is provided for the list, the values are appended after any existing items in the list.

The following XML represents the INPUT_TABLE parameter in the SOAP request:

<INPUT_TABLE) 
    {$ /process_data/SAPtable $} 
</INPUT_TABLE>

For testing the SOAP request in the development environment, use an item element to represent a list item. Each item element contains one element for each table column:

  • The element names are the column names.

  • The element character data is the column value.

<INPUT_TABLE) 
    <item> 
        <COL1>value1</COL1> 
        <COL2>value2</COL2> 
        <COL3>value3</COL3> 
    </item> 
    <item> 
        <COL1>valueA</COL1> 
        <COL2>valueB</COL2> 
        <COL3>valueC</COL3> 
    </item> 
</INPUT_TABLE>

// Ethnio survey code removed