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 (see step 2 below).
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 (see also step 8 below).
2. Import the RFC to the Enterprise Services Repository (more information: Importing IDocs and RFCs).
3. In the Enterprise Services Repository, create a message mapping with a source and target structure, or open an existing message mapping for editing.
4. 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.
5. 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.
6. Drag the standard function RFC Lookup in function category Conversions to the data-flow editor and define the call graphically in the function properties:
a. Select the import message-mapping parameter for the RFC adapter from the dropdown list box (MMP_RFC from step 4). 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 (see steps 7 and 9).
b. Call input help and select the imported RFC from step 2.
c. 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 dataflow 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.
d. 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 bottommost 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.
7. 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 IM_RFC.
To execute or test the mapping program and the mapping lookup, perform the following steps in the Integration Directory:
8. If you want to use a different RFC receiver channel to the one in step 1, create a new receiver channel for calling the application system in the Integration Directory (see: Communication Channel and Configuring the Receiver RFC Adapter ).
9. To transfer the ID of the receiver channel to your message mapping program at runtime, create an interface determination and assign it the operation mapping from step 7 (see step 6 in Defining an Interface Determination ). Then, in the interface determination, you can then assign the receiver channel to the operation-mapping parameter (in the example IM_RFC).
You can only execute the mapping lookup once you have performed these steps and have installed the runtime components of the Integration Server. If this is not the case, the message mapping program will terminate with an error message.
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 (see: Test Environment for Operation Mappings ).