Creating and Configuring an end-to-end A2A scenario using SAP PI – Part I
While working with SAP PI as a novice, we all have faced the initial hurdle of how to start and from where. Hence, in this blog series, I would like to share some of my experiences in building an A2A (Application-To-Application) scenario using enterprise services and consuming those services in ABAP.
This is a two part series blog which would demonstrate the following scenario in a step by step manner:
- Designing/Creating asynchronous enterprise service
- Creating a consumer service proxy
- Consuming a ESR service in ABAP and triggering these service calls using a BPC datamanager package
- Configuring enterprise services using SAP PI
I would also show a few variation of the above scenario, like configuring the services using SAP PI runtime and how only a SAP BW process chain can be used to trigger the services.
Note: The PI system that is shown in this example has the version 7.11.
To start with, let’s understand what is exactly meant by A2A scenario. A scenario is termed as an application to application scenario incase the exchange of service interface messages is used to integrate internal company processes. Hence, in case the components between which the data flows are internal company processes, it can be said as an application to application data flow.
The following diagram depicts the integration between two systems through SAP PI:
The system in which the service is created is usually referred to as the “Provider System” and the system in which the consumer proxy is created is usually referred to as the “Consumer System”.
SAP calls PI an integration broker because it mediates between entities with varying requirements in terms of connectivity, format, and protocols. According to SAP, PI reduces the Total Cost of Ownership (TCO) by providing a common repository for interfaces. The central component of SAP PI is the SAP Integration Server, which facilitates interaction between diverse operating systems and applications across internal and external networked computer systems.
PI is built upon the SAP Web Application Server.
Note: The ABAP application server for the consumer and provider system should be present in the SLD of the PI system. A corresponding technical system and business system for the ABAP AS would be required to be created in the PI system SLD. This can be done, as shown in the blog link given below or with the help of the BASIS team.
Scenario: In this blog, let’s try to send a text from the consumer system and get it stored in a table of the provider system. Hence the service and the consumer proxy would look something like this:
Designing/Creating asynchronous enterprise service
In this section we would see the creation of a service definition and consumer proxy. A consumer proxy is a service that is used to consume/call a service.
To create a service, follow the steps below:
- Log into the ABAP AS of the Provider System
- Go to the transaction SXMB_IFR
- Go to the Enterprise Service Repository (ESR) in the resulting web page.
- Use your log in credentials for the PI system to log on to the enterprise service repository
- Once the repository opens, navigate to the namespace in which you would like to create the PI objects.
- The following objects have to be created in the same order In which they are mentioned:
- Data Types:
- Right click on Data Types and choose Create
- Provide a name and description for the data type, choose theClassification as Aggregated Data Type and select Create.
- Select either one or many attribute to include as a parameter for the consumer proxy.
- Save and Activate.
- Data Types:
(For the above example, you can create a data type with an element of Type Short_Description)
- Message Data Types
- Right click on the Message Type.
- Provide a technical name and description and Create
- Provide the Data Type which is created in the above step in the fieldData Type Used
- Save and Activate.
- Service Interface:
- Right click on the Service Interface
- Provide a name and description and Create
- Choose the Category as Outbound, Interface Pattern as Stateless (XI30-Compatible). Select the checkbox Point-to-Point-enabled.
- Select the mode as Asynchronous and Operation Pattern as Normal Operation
- Select the Request Type as Message Type and provide the name of the message type created in the last step
- Save and Activate
- Go back to the ABAP AS and run the transaction SPROXY
- Navigate to the namespace in which the service interface has been created in the ESR
- Right click on the service interface and choose Generate Proxy.
- Provide a package, prefix using which all the objects of the enterprise service will be created
- Once the proxy class in generated, navigate to the method of the proxy class and as per the above example, implement the logic for the service.
Note: This is called the outside-in approach of creating services in which an external service definition for example, a service definition created in the ESR, is used to create the service. In the inside-out approach, an existing functionality (like a function module in which the business functionality is available) is exposed as a service.
Creating the consumer service proxy
To create a consumer proxy log into the ABAP AS of the consumer system and follow the same steps as service , with the following settings for the Service Interface part.
- Choose the Category as Inbound
- Interface Pattern as Stateless (XI30-Compatible)
- Select the checkbox Point-to-Point-enabled
- Select the mode as Asynchronous
- Operation Pattern as Normal Operation
Once the consumer proxy is designed in the ESR, it has to be generated in the consumer system ABAP AS, with the help of the SPROXY transaction. As in the case of the service, the logic for the consumer proxy also has to be implemented in the proxy class method.
A consumer proxy can also be created from the repository browser (transaction se80) of the consumer system using the service creation wizard. For that:
- Go to the transaction se80
- Navigate to your package. Select Enterprise Services -> Create
- Select Service Consumer in the resulting pop up
- Select the option URL/HTTP Destination, to provide the WSDL url of the service for which the consumer proxy has to be created.
- Save and activate
Note: A Message Data Type and the corresponding Data Type for the consumer proxy has to be created separately.
More in the next part of the blog …