The data-flow editor in the mapping editor has the standard function RFC lookup with which you can define a mapping-lookup using the RFC adapter graphically. The function takes the request, response, and fault parts of an imported RFC into account.
To be able to model the lookup graphically, the structure of the RFC must be known. To use this structure in the mapping editor, you must import the RFC to the Enterprise Services Repository.
Enable RFC Call and Import RFC for Mapping Editor
In the Integration Directory, create the RFC receiver channel for the call to the application system.
This receiver channel is initially only required for testing the lookup. The developer or consultant can create a different receiver channel later to call the same RFC in a different system. Import the RFC into the Enterprise Services Repository.
Define a Parameterized Message Mapping Program
In the Enterprise Services Repository, create a message mapping with a source and target structure, or open an existing message mapping for editing.
In the mapping editor, switch to the Signature tab page. Create an import message-mapping parameter of category Adapter (for example, MMP_RFC ) and assign it the adapter metadata of the RFC adapter. The adapter metadata of the RFC adapter is shipped in software component SAP BASIS.
In the mapping editor, navigate to the Definition tab page and then to the target-field mapping for which you want to define the RFC lookup.
Drag the standard function RFC Lookup in function category Conversions to the data-flow editor and define the call graphically in the function properties:
- Select the import message-mapping parameter for the RFC adapter from the dropdown list box ( MMP_RFC). The message mapping uses this
- parameter later to transfer the ID of the receiver channel to the function which is to be used for the lookup.
- Call input help and select the imported RFC .
- To define the RFC call, in the function properties for standard function RFC Lookup, model the inbound and return parameters for the function, and model how they are associated with the request and response parameters of the RFC. If you connect source fields or functions with the inbound parameters later, you implicitly define a mapping between these source fields or functions and the parameters of the RFC request (left-hand side). At runtime, this mapping is processed in the same way as a target-field mapping. In the function properties, you then define which parameters of the RFC response can be assigned to target fields or functions by using the return parameters in the data flow editor (right-hand side).
Define the mapping as follows:
- To use a parameter from the RFC request or the RFC response as the inbound or return parameter for the standard function RFC lookup, double-click the parameter in the structure. The parameter is then transferred to the table in the lower screen area. In the table you can also define the sequence of the inbound or return parameters.
- Parameters in the RFC that are not scalar values are displayed in the dialog box in bold. Such parameters are, for example, table parameters in the RFC that are mapped to elements with maxOccurs = unbounded . The same rules as for normal target-field mappings apply for the mapping to the parameters of the RFC request, or for the mapping from the parameters of the RFC response.
- Instead of offering a parameter of the RFC request as the inbound parameter of the standard function RFC lookup, you can also enter a constant in the structure.
- You can handle exceptions defined in the RFC as follows during the RFC lookup:
- If you have selected the Use Exceptions checkbox in the function properties of the standard function, the mapping editor adds an additional parameter in red (the bottom most return parameter) to the standard function in the data-flow editor. If you do not assign a target field to this return parameter, ignore the RFC exceptions (the message mapping is not terminated at runtime). Otherwise the mapping runtime transfers the exception as an XML structure and it can then be evaluated in a user-defined function, for example. If there is no exception, the mapping runtime transfers an empty context.
- If you have not selected the Use Exceptions checkbox, the mapping runtime terminates the message mapping if an exception occurs during the RFC lookup.
If, later, you want to assign a receiver channel to the message-mapping parameter that you assigned the import function parameter to in step 1 ( MMP_RFC ), you must assign this import parameter to an operation-mapping parameter by using a binding (see step 4-8 in Defining and Using Import Parameters), for example OM_RFC .
You have defined a lookup in your message mapping by using the standard function RFC Lookup, and have configured it in the Integration Directory. You can now test the message mapping program in the operation mapping.