Skip to Content
Author's profile photo Former Member

Write for Web Services but use RFC

Consumer Mapping

If you have an application that is going to communicate with several systems (on different releases, for example), the services in the various systems may expect different communication types.

You can write an application to call a particular service but then, without changing the coding, call a different service that is semantically similar. I will illustrate this, with what is almost the „hello world” of consumer mapping, using a call to a Web service and then a call to an equivalent remote-enabled function module. An even simpler example would involve two Web services but the reasons for doing that may not be so obvious.

Starting Point

In a provider system I exposed a function module as a Web service. In the consumer system I created a corresponding consumer proxy. The application calls the Web service in the usual way by specifying the consumer and the logical port.



Second Provider System

In another system there is no corresponding Web service but there is the same function  module as used in the Web service – you don’t get much more semantically similar than that and it makes the mapping trivial.



A Little Development

I do not touch the application and the existing Web service consumer is not capable of calling the function module directly. So I first create an RFC consumer that will communicate with the function module. Then I create the consumer mapping between the Web service consumer and the RFC consumer. The Web service consumer is the “source consumer” and the RFC consumer is the “target” consumer”. Because there is only one target this is called single target consumer mapping (STCM).


Configuration and Execution

The final step is to configure the STCM in SOA Manager. This is basically specifying the logical port, which in this case entails configuring an RFC destination. For the application, nothing has changed. But now, depending on the logical port used, the call is made to the naked function module.




Since STCMs are a separate type of ABAP development object, a customer or partner, or other organization, could create their own STCM objects in order to manipulate outbound messages without modifying the sending application. For example, a web service consumer in an SAP-delivered scenario does not exactly match the service in an existing landscape. The customer could create the appropriate STCM based on the service consumer and the data structure of the addressed service, and do the mapping to provide the correct message structure.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.