
You use RFC consumers to call function modules in other systems using a Web service. This is useful if the provider system only has an RFC infrastructure that cannot be connected using Web services, or if the application logic is already exposed by RFC and is not offered as a Web service.
Creating an RFC consumer is the same as creating a (Web) service consumer. The difference is that for RFC consumers you specify the function module to call. The user calling the function module must possess the necessary authorization. The S_RFC authority object can be maintained for the authority check. If authorization fails, a SAP GUI popup appears (standard behavior for all RFCs).
You must use a service consumer as the source consumer of a single-target consumer mapping, and the RFC consumer as the target consumer. Otherwise, it is not possible to configure the RFC consumer. For more information on single-target consumer mappings, see Working with Consumer Mappings.
Each operation of an RFC consumer is based on one RFC-enabled function module. When an RFC consumer is created, optional parameters from the function module can be excluded from the RFC operation. When the RFC consumer is activated, an ABAP Connector (ACO) class is generated that is used at runtime to call the function module.
For more information, see SAP ABAP Connector.
You use the Enterprise Services Wizard to create an envelope for the RFC consumer. Then you add operations in the proxy editor.
Create an RFC consumer using the Enterprise Services Wizard.
For more information, see Enterprise Services Wizard.
An empty RFC consumer without operations is opened in the proxy editor. You can save it and add operations later or proceed with the next steps.
On the Detail View tab in the proxy editor, select the top node and specify the interface pattern and (optionally) the security level.
Right-click the top node and choose Add Operation in the context menu.
The Enterprise Services Wizard opens. In the wizard, specify the RFC function module on which you want to base the operation of the RFC consumer. You can either use a local file or specify the RFC destination (optional) and the name of the function module. If you do not specify an RFC destination, the function module must be available in the local system.
For more information about how to create a file from an ABAP Connector class, see Generating Static Proxies.
The ABAP Connector class of the function module is displayed as an RFC operation in the proxy editor. The importing parameters from the ACO class are combined as a request message; the exporting parameters build the response message, and the exceptions are the fault message(s). Changing parameters from the ACO class are also included in the request and response messages. If there were table parameters in the original function module, they become changing parameters in the ACO class.
For more information, see SAP ABAP Connector.
You can add further operations in the same way.
For each optional parameter of the function module, specify whether you want to include it in the generated RFC consumer. By default, all optional parameters are included.
Save the RFC consumer and activate it.
After completion, an ABAP Connector class is created for the function module.
Regenerating an Operation
If a function module has been changed in its original system and you want the RFC consumer to reflect these changes, you can regenerate the operation that is based on it.
(Optional) Check whether a generation would change the operation by right-clicking an operation on the Detail View tab and choosing Check Regeneration in the context menu.
The Enterprise Services Wizard opens to retrieve the signature of the function module.
(Optional) Specify the function module in the wizard.
If you choose to use the signature of a function module on the first page of the wizard, the correct function module is offered on the following page. You can also choose to get the signature of the function module from a local file. On completion of the wizard, the function module is checked and the results are displayed at the bottom of the proxy editor.
On the Detail View tab in the proxy editor, right-click an operation node and choose Regenerate in the context menu.
Note that you must be in Edit mode to trigger the regeneration.
The Enterprise Services Wizard opens.
Specify the function module in the wizard. On completion of the wizard, the RFC operation is regenerated and displayed in the proxy editor.
Save and activate the RFC consumer.
You can use an RFC consumer as the target consumer of an operation mapping.
SAP ABAP Connector