You are on page 1of 18

What is ABAP Proxy?

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.

Everything you must know about working with


Proxies in SAP PI/PO and SAP ABAP.
Here is the overview of what is covered in this article.

 Overview of Proxy standards


 Overview of ABAP Proxy Objects, Generation, View
 Step by step instruction on generating Proxy in PI/PO
 Step by step instruction on generating ABAP Proxies in backend and start
development
 Testing ABAP Proxies
 Send Data from SAP to an Outbound Proxy
 Difference between Proxy and IDoc
 Designing Interfaces and Proxy Generation Purpose

Overview of Proxy Standards


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 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 superordinate message
interface and are not reused by the proxy generation function. RFC exceptions are
grouped in an exception class.

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

1 Connections com.sap.aii.connect.repository.name

2 Connections com.sap.aii.connect.repository.httpport

3 Connections com.sap.aii.connect.repository.contextRoot

4 Connections com.sap.aii.connect.integrationbuilder.startpage.url

5 Application System com.sap.aii.applicationsystem.serviceuser.name

6 Application System com.sap.aii.applicationsystem.serviceuser.pwd

These parameters are not to be set by developers but by the administrator


responsible for the technical configuration of the PI/PO 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.

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.

Steps Needed to Configure SAP PI/PO for


Generating Proxies

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:
Steps need to Create Inbound and Output
Proxy in SAP ABAP using SPROXY
Creating of Client Proxies
Go to the 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

Testing ABAP Proxies


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”
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 a 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.

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.

What is the difference between ABAP Proxy


and IDoc
An ABAP Proxy is a direct way to interact with PI and external third party systems
and is designed to work very similar to an API. this makes it easy to enable web
services within SAP whereas IDoc is just a messaging document. Viewing the
message content for proxy happens in PI or using transaction SMX_MONI whereas
for IDoc you will have to use WE02, BD87 for message content.
Share this:



Like this:

Loading...

Continue Reading
PreviousWorking with Internal Tables in SAP ABAP
NextWeb Dynpro In a Nutshell

More Stories
 ABAP

22 ABAP Tips for Better Programming

 ABAP

SAP ABAP Tutorials for Beginners and Newbies

 ABAP

SAP LSMW Hands on – Step by Step Instructions


1 thought on “Interfacing using ABAP Proxy in
SAP – End to End Guide”
1. Alexandr Aldoshkin says:

August 26, 2014 at 1:58 am

Very good, thank you!

Reply

Leave a Reply
Your email address will not be published. Required fields are marked *

Comment

Name *
Email *
Website

Post Comment

You might also like