ABAP Proxy is one of the most remarkable forms of communication between SAP application system and SAP PI. The proxy provides both asynchronous and synchronous mode of communication. In order to utilize Proxy, the application system should have WAS > 6.20. Proxies are used to connect the application system to the PI system. The role of the Business system at the application side is LOC Application system and that at the PI side is HUB Integration server.

Designing Interfaces and Proxy Generation Purpose

Generally speaking, interfaces are where functions in a system can be executed. In the context of SAP Exchange Infrastructure, only the following interfaces are relevant:

  • Interfaces designed for message exchange between application systems
  • Interfaces used by a cross-component integration process to receive or send messages, or both

Starting with a cross-system integration process, you can then derive the corresponding interfaces required. SAP Exchange Infrastructure supports this process by using an integration
scenario to describe the collaborative process. The integration scenario summarizes the interfaces required for this collaborative process.

You can use SAP interfaces that already exist in systems, non-SAP interfaces that are connected to SAP Exchange Infrastructure using adapters, or define new interfaces called message interfaces in the Integration Repository. Both worlds can also be interconnected in a collaborative process.

ABAP Proxy Objects

All ABAP objects that are created when you generate an interface object from the Integration Repository in an SAP system are called ABAP Proxy Objects.

You can divide the different interface objects (the objects from the Integration Repository from which you generate proxies) into two classes: The message interfaces itself and the corresponding parameters and data types. Each generated proxy object can be assigned to its corresponding interface object in the Integration Repository even after generation. The ABAP proxy generation function notes this assignment using metadata, which is transported with the proxy object.

Message interfaces can have the mode synchronous or asynchronous. Furthermore, the category of the message interface determines what type of proxy is generated.

  • The counterparts to outbound message interfaces in application systems are client
    proxies. They are called to send a message to an inbound interface. An outbound message interface is mapped to an ABAP object class (prefix CO_).
  • The counterparts to inbound message interfaces in application systems are server
    proxies. They are called to start a service that, in the synchronous case, returns a result. The proxy generation functions generate an ABAP object interface (prefix II_) for an inbound message interface; you must implement this interface using an ABAP object class to make this service available.

     

This class must be recognized by the ABAP proxy runtime so that it can call the appropriate method when a message arrives. The proxy generation function enters an implementing class as the default setting on the tab page Properties; this class is generated after the proxy has been activated. If you want to use a class that already exists, enter it in this field.

The system generates methods with the following names, depending on the type of communication:

  • In the case of synchronous interfaces, the method is called EXECUTE_SYNCHRONOUS.
  • In the case of asynchronous interfaces, the method is called EXECUTE_ASYNCHRONOUS.

These names apply, regardless of whether the interfaces are inbound or outbound message interfaces. A proxy class also contains methods for implementing protocols as well as enabling message exchange.

Parameters and Data Types

The following can be established for both outbound and inbound message interfaces:

  • The output message type becomes a parameter with the name OUTPUT. The input message type becomes a parameter with the name INPUT. OUTPUT refers to an outbound message, INPUT to an inbound message. Both parameters are structures of the respective message type with a field for the data component of the message.
  • The data component of the message is communicated with by using the message type name. For example, if the message type is Report and it references the data type InvoiceData, then a structure Report of type InvoiceData is generated.

Proxy generation saves a reusable data type in the ABAP Dictionary for global XSD data types, for example data elements or structures. It generates fields of a structure for local elements or attributes. The reuse of data types in the Integration Repository is reflected in the data types created in the system.

Integration

You cannot change ABAP proxy objects manually in the SAP system. You can only change an ABAP proxy object by using the ABAP proxy generation function. ABAP proxy objects only map data structures defined in the Integration Repository. Therefore, they are not supported and must not be used on the interface.

Message Interfaces with RFC or IDoc Messages

You can generate ABAP proxies for message interfaces that reference RFC or IDoc messages. The generated proxy objects (for example, classes and generated structures) use the name of the message interface that references the message as the prefix in the technical name. The proxy objects belonging to the RFC or IDoc message belong to the super- ordinate message interface and are not reused by the proxy generation function. RFC exceptions are grouped in an exception class.

Example

The following graphic illustrates how an interface from the Integration Repository is mapped to an ABAP proxy:

ABAP Proxy Generation

Using ABAP the proxy generation function you can generate ABAP proxy objects to an SAP system from an interface description in the SAP Exchange Infrastructure Integration Repository.

ABAP proxy objects can only be generated for SAP systems that are based on SAP Web Application Server 6.40.

The proxy generation retrieves the WSDL description of the interface from the Integration Repository using HTTP. The address of the appropriate server is taken from the exchange profile (parameters 1, 2, and 3 – see below). Queries to the Repository are subject to authentication. The user and password for these queries are also taken from here (parameters 5 and 6). Information used to navigate from the ABAP Proxy Generation to the initial page of the Integration Builder is also taken from the exchange profile (parameters 1, 2, and 4).

Example configuration for accessing
interfaces in the Integration Repository (exchange profile)

No. Section Parameter Value (Example)
1 Connections com.sap.aii.connect.repository.name pwdf0436
2 Connections com.sap.aii.connect.repository.httpport 1080
3 Connections com.sap.aii.connect.repository.contextRoot Rep
4 Connections com.sap.aii.connect.integrationbuilder.startpage.url rep/start/index.jsp
5 Application System com.sap.aii.applicationsystem.serviceuser.name Hugo
6 Application System com.sap.aii.applicationsystem.serviceuser.pwd Hugopass

These parameters are not to be set by developers but by the administrator responsible for the technical configuration of the XI system landscape. You must also have created message interfaces in the interface maintenance of the Integration Repository before you can generate for these proxies. You can send and receive messages using the generated ABAP proxies.

Features of ABAP Proxy

You can edit ABAP proxy objects either in the Object Navigator (transaction SE80) or in transaction SPROXY:

  • The Object Navigator displays proxy objects created in the system in the navigation tree under Enterprise Services ® Web Service Library (client proxies, server proxies, and proxy Dictionary-objects). When you create new proxy objects, the hierarchy of software component versions from the Integration Repository is displayed in a dialog box.
  • You can display the interface objects from the Integration Repository by using the navigation tree in transaction SPROXY. If no connection to the Integration Repository exists, the tree presents an overview of those interface objects for which a proxy object already exists in the system.

Both transactions show the following information on the right-hand side:

Tabs displayed when generating an ABAP proxy

Tab Page Meaning
Properties Generation attributes such as package, last changed by, and so on. For inbound proxies, specify the name of the implementing class here.
Name conflicts This tab is only displayed immediately after the proxy is generated. It allows you to correct names that were truncated during generation, or that needed to be changed because a collision occurred.
Generation A list of all the objects generated for an object
Structure This tab is similar to the Generation tab, except that here the objects are sorted according to their use in a tree structure.
Example:
Class CO_X
->Method MYMETHOD
->Importing OUTPUT
Documentation The system displays the documentation from the Integration Repository for the outbound object.
Type mappings Even if a proxy was generated successfully, there are cases when generation was only possible due to implicit acceptance (for example, restrictions to the value range are checked by the programmer). If such situations arose during generation, they are listed in an application log.

Accessing Interface Objects

Object SE80 SPROXY
Generated Objects Navigation tree in object navigator Navigation tree in transaction SPROXY
Integration Repository Objects Popup with hierarchy of software component versions Navigation tree in transaction SPROXY

Software component versions and namespaces of the Integration Repository are only displayed if they are available locally in the system. The selection of software component versions in the navigation tree in the SPROXY or SE80 dialogs is also a subset of the software component versions of the Integration Repository.

Views in Transaction SPROXY

In transaction SPROXY, you access both Integration Repository objects and generated objects by using the navigation tree. If namespaces are deleted there, then they are no longer visible in the navigation tree in transaction SPROXY, however it is possible that proxy objects already exist in the system for these namespaces. For this reason, the navigation tree in transaction SPROXY has two views:

Proxy-Objects View (Menu Goto ®
View)

View Meaning
All Generated Objects You can access all proxy objects that have ever been created in the system. You only require this view if namespaces or software component versions have been deleted in the Integration Repository. All generated objects are displayed in the navigation tree in transaction SE80.
Integration Repository Objects

(Default Setting)You can access all interface objects that are currently visible in the Integration Repository, as well as the corresponding proxy objects.

Translation and Package Assignment

When proxy objects are generated, the number of ABAP Dictionary objects, classes, and interfaces created can lead to a considerable volume of translation. This translation is pointless, however, since these proxy objects do not appear in user interfaces. You should therefore ensure that proxy objects are separated at package level. Create a separate package for the proxy objects and flag it as not relevant for translation.

Activities..

  • Generate ABAP proxy objects for an interface or for other interface.

If a connection to the Integration Repository could not be established at the start of the transaction, you can ascertain more exactly what went wrong, and fix this problem (or have it fixed), by choosing Goto Connection Test.

  • Check whether you need to make any changes following the automatic naming of proxy objects.
  • If the description was changed in the Integration Repository, you must regenerate the proxy objects:

Call transaction SPROXY and in the navigation tree, either choose the changed interface object itself, or an object that contains the changed object. Call the context menu for this interface object and choose Change Proxy.

DESIGN & CONFIGURATION

DESIGN TIME

Data Type:

Message Type:

Message Interface (Outbound)—Client proxies are created for Outbound Interfaces

Message Interface (Inbound)—Server proxies are created for Inbound Interfaces

Message Mapping:

Interface Mapping:

CONFIGURATION TIME:

Sender Agreement

Sender Communication Channel (XI Adapter)

Receiver Determination

Interface Determination:

CLIENT PROXIES

Client Proxies are generated for Outbound Message Interfaces. These are used to send out Data from SAP system to external Application. Sproxy is the transaction to generate Proxies.

PREPARATIONS BEFORE CREATING PROXIES IN ANY SYSTEM

The package structure is the most important. The following URL’s will help in understanding the package structure in a better manner.

http://help.sap.com/saphelp_nw04/helpdata/en/ea/c05d92f01011d3964000a0c94260a5/frameset.htm

Structure Package(ZXI_PACKAGE)———————————-Level1

Main Package(ZSCSLSAP)————————————Level2

Sub Package(ZSIVA_SCSLCOMP)——————Level3

SubPackages(ZSIVA_SCSLCOMP_PROXY2PROXY)–Level4

(All the objects that are created should be assigned only at level4)

Creating of Client Proxies

Go to SAP system

sproxy transaction and select the Outbound interface for which the Client proxy needs to be generated. ( FlightData_OUT_MI in urn:PROXY2PROXY in SIVA_SCSLCOMP this case)

Select the package in which the Objects need to be created. Prefix Z, else the Objects generated will be SAP Objects that require access key

The following Objects are generated for an ABAP Client Proxy

  • Interface
  • Message Type
  • Data Type

Click on ABAP Class to see its methods and parameters

Click on Parameters to look at the
Output
and the Associated Message

Click on Associated Type to see the Message Type

Click on MessageType
to see the Data Elements

How to Test the Interface that has been generated

How to Send Data from SAP to an Outbound Proxy

We need to create a Program (in se38) which sends the data out to the class that has been generated. The class that is generated will send data to the Integration server

The following link refers to “Sending a message using ABAP Proxy Runtime”

http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

To send a message using the ABAP proxy runtime, call the corresponding client proxy in your application program.
1. Declare the following variables:

DATA:

* Reference variables for proxy and exception class
lo_clientProxy TYPE REF TO [Generated proxy class],
lo_sys_exception TYPE REF TO cx_ai_system_fault,
 
* Structures to set and get message content
ls_request TYPE [Output message type],
ls_response TYPE [Input message type].

2. Complete the structure ls_request for the request message.

3. Instantiate your client proxy.

TRY.

* create proxy client

CREATE OBJECT lo_clientProxy( 'LOGICAL_PORT_NAME' ).

LOGICAL_PORT_NAME is the name of the logical port that you want to use, which is used to define the receiver. You can omit this parameter if you are using a default port or the XI runtime.

4. To send a message, call the corresponding client proxy method. WSDL allows several such methods (specified by the element <operation>). In XI, there is only one method, with the default name EXECUTE_SYNCHRONOUS or EXECUTE_ASYNCHRONOUS. Catch at least the exception cx_ai_system_fault:

* do synchronous client proxy call

CALL METHOD lo_clientProxy-&gt;execute_synchronous
 
EXPORTING output = ls_request
IMPORTING input = ls_response.
 
CATCH cx_ai_system_fault INTO lo_sys_exception.
 
* Error handling
 
ENDTRY.

REPORT ZPROXY_FLIGHT_DATA.
 
DATA prxy TYPE REF TO ZCO_FLIGHT_DATA_OUT_MI.
 
DATA fault TYPE REF TO cx_ai_system_fault.
 
DATA It_request TYPE ZFLIGHT_DATA_MT1.
 
It_request-FLIGHT_DATA_MT-CARRID = 'AA'.
 
It_request-FLIGHT_DATA_MT-CONNID = '0017'.
 
It_request-FLIGHT_DATA_MT-FLDATE = '20040404'.
 
TRY.
 
CREATE OBJECT prxy.
 
CALL METHOD prxy-&gt;execute_asynchronous
 
EXPORTING output = it_request.
 
commit work.
 
CATCH cx_ai_system_fault into fault.
 
WRITE :/ fault-&gt;errortext.
 
ENDTRY.

SERVER PROXIES

Server Proxies are generated for Inbound Message Interfaces. These are used to Process the Data coming into SAP System from an external application. Sproxy is the transaction to generate Proxies.

PREPARATIONS BEFORE CREATING PROXIES IN ANY SYSTEM

The package structure is the most important.

The following URL’s will help in understanding the package structure in a better manner.

http://help.sap.com/saphelp_nw04/helpdata/en/ea/c05d92f01011d3964000a0c94260a5/frameset.htm

Structure Package(ZXI_PACKAGE)———————————-Level1

Main Package(ZSCSLSAP)————————————Level2

Sub Package(ZSIVA_SCSLCOMP)——————Level3

SubPackages(ZSIVA_SCSLCOMP_PROXY2PROXY)–Level4

(All the objects that are created should be assigned only at level4)

ZSIVAINSERT is the RFC Used to insert Data into R/3 Tables

If the combination of carrid, connid and fldate exists, it returns 1

Else, it inserts the Data into SFLIGHT Table and returns 0

IMPORT Parameters

Export Parameters

Creating of Server Proxies

Go to SAP system, Sproxy transaction and select the Inbound interface for which the Client proxy needs to be generated.

Select the package in which the Objects need to be created. Prefix Z, else the Objects generated will be SAP Objects that require access key

The following screen is displayed if there are any conflicts with the generated names and already existing names in the system. Go to generation Tab to change the names of the Objects manually. Else the system will take care of the Object naming.

The following Objects are generated for an ABAP Server Proxy

  • Interface
  • Message Type
  • DataType

A class implementing the Interface is also generated. The methods inside the Class are used to process the data.

Click on Parameters to look at the
Input
and the Associated Message

Click on Associated Type to see the Message Type

Click on MessageType
to see the Data Elements

Click on the method (____Execute_Asynchronous) to write the code to handle the data.

*These are local variables used to capture the values that are received as import parameters.

data :

lv_CARRID type S_CARR_ID,
 
lv_CONNID type S_CONN_ID,
 
lv_FLDATE type S_DATE.
 
* Convert Input Parameters
 
lv_CARRID = input-FLIGHT_DATA_MT-CARRID.
 
(Local variable)= (keyword)-(Name of the Message type)-(Variable name)
 
lv_CONNID = input-FLIGHT_DATA_MT-CONNID.
 
lv_FLDATE = input-FLIGHT_DATA_MT-FLDATE.
 
* (ZSIVAINSERT is a function module that inserts data into Spfli table)
 
call function 'ZSIVAINSERT'
 
EXPORTING
 
CARRID = lv_CARRID
 
CONNID = lv_CONNID
 
FLDATE = lv_FLDATE.
 
endmethod.

Save and activate Method, Class, Interface in the same order

Save and Activate the Method.

Save and active Class

Save and activate Interface.

  1. How to Test Data has reached the System or not

Check the data in the table into which the Function module (that is called in the method __Execute Asynchronous) to insert the data.

(In this case ZSIVAINSERT is a function module that inserts data into SFLIGHT (table)

After executing the scenario

More abap tutorials

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here