Skip to content
DonMartin76 edited this page Jul 24, 2015 · 2 revisions

The SAP Transformer can be leveraged to call a SAP RFC for each source row in a source file. The output values of the RFC calls can subsequently be used in the field definitions of the target file:

<SourceTransform>
  <Transform config="[path to config]">sap://RFC:[rfc name]</Transform>
  <Parameters>
    <Parameter name="[param path]">[param expression]</Parameter>
    ...
  </Parameters>
  <Settings>
    <Setting name="[setting]">[setting config]</Setting>
	...
  </Settings>-->
</SourceTransform>

In path to config, the path to the SAP Configuration File must be passed. The rfc name must give the name of the (accessible) RFC to call on the SAP system specified in the configuration file.

Passing parameters to the RFC

In order to pass parameters to the RFC, any expression param expression can be used to retrieve source fields. The parameter param path must be named using the standard SAP notation, using hyphens to denominate structures and substructures. Example:

<Parameter name="REQUEST-COMPANY_ID">$Id</Parameter>

The name of the parameter is obviously depending on the RFC which is to be called.

Supported Settings

Currently, the only supported setting is flatten:

<Setting name="flatten">[output table to flatten]</Setting>

The output table to flatten must give a name of a TABLE structure in the output structure of the RFC. If it does not, an error is thrown.

Interrogating the RFC for input and output structures

Any time the SAP Transformer is successfully instantiated, it will output the correct names of all input and output parameters to the logger instance, using the info log level.

In order to use this functionality to retrieve the correct parameter and field names, you may e.g. use the inline:// (Inline Reader) notation to just instantiate the transformer but not actually passing any values to it:

<Logger type="std" level="info" />

<Source config="Key">inline://</Source>
...
[Source Transform definition]

If you have a correctly configured SAP Transformer, the plugin will output a list of all valid parameters and all valid output values, as field references.

Accessing TABLE output structures

In case a TABLE structure is found in any of the output or input structures, these will be denominated with square brackets in the field output (see above):

RESPONSE-RESULT_LIST[]-NAME
RESPONSE-RESULT_LIST[]-STREET
...

This means, inside the RESPONSE structure, there is a TABLE type sub structure named RESULT_LIST, which in turn contains the fields NAME and STREET.

In order to access a specific instance of the RESULT_LIST, use the following syntax:

<Field name="Name">$RESPONSE-RESULT_LIST[0]-NAME</Field>
<Field name="Street">$RESPONSE-RESULT_LIST[0]-STREET</Field>

This notation assumes that there is at least one instance in the RESULT_LIST; if there is not, an error is thrown.

For a better support of TABLE sub structures, use the flatten setting, applied to this example like this:

<Setting name="flatten">RESPONSE-RESULT_LIST</Setting>

This means that the source record which is applied to the transformer will be returned once for each occurance of a RESULT_LIST instance. The fields inside the structure can then be accessed like this:

<Field name="Name">$RESPONSE-RESULT_LIST-NAME</Field>
<Field name="Street">$RESPONSE-RESULT_LIST-STREET</Field>

If there are no entries in the RESULT_LIST table, this will not return an error, but rather return empty strings.

Tables in input structures

Tables are also supported in input structures. In these cases, an explicit table index has to be given; a generic table handling mechanism as with flatten does not exist.

Example:

<Parameter name="IS_IN-ID_LIST[0]-ID">$SAP_IN_ID</Parameter>
<Parameter name="IS_IN-ID_LIST[1]-ID">$SAP_IN_ID_2</Parameter>

The SAP Transformer will automatically add two entries to the input table ID_LIST and set the fields ID in the corresponding records to the given expressions ($SAP_IN_ID and $SAP_ID_IN_2, respectively).

Note: The table entries will be re-used. This will probably not pose a problem, as for each record the input parameters are overwritten. If you experience problems here (e.g. with CHANGING parameters), please file an issue with an example of where it goes wrong.

Prerequisites

See SAP Prerequisites and SAP Configuration File.

Clone this wiki locally