SAP proxy model enables to differentiate Integration logic from the Application logic, proxies are outside-in development approach where we can generate executable interface from non-language specific code (like WSDL). In SAP Exchange Infrastructure environment using proxy runtime application system (Business System) can send and receive messages from/to the Integration Server.
SAP provide two approaches to implement proxies
1. ABAP Proxies
2. Java Proxies
Software Requirements
WAS 6.20 with xi2.0 add-on is the minimum configuration to support ABAP proxies, updating to WAS 6.40 need regeneration of all the proxy objects generated on previous versions.
SAP J2EE Engine 6.40 with Service Pack SP5 or higher needed to work with proxies, along with this installing Java Proxy Runtime (JPR) and Messaging Service (MS), which provides services like messaging, queuing, and persistency of XI messages.
The following figure illustrates the scenario where ABAP proxy as synchronous inbound, which receives the request message from Integration Server and the ABAP proxy runtime processes and send the response.
Step-By-Step
Before proceed to the actual procedure we assume that the configuration steps between R/3 and PI are done successfully.
In Exchange Infrastructure's Repository we need to create the following objects.
1. Namespace
2. Data Type
3. Message Type
4. Message Interface
5. Mapping Program
6. Mapping Interface
1. Implementing the Inbound ABAP Proxy
In Receiver R/3 system go to transaction SPROXY and select the inbound interface and create server proxy, this will generate Interface and implementing class, along with this structure objects and table type.
You can view the structure of the method EXECUTE_SYNCHRONOUS in the interface generated.
In order to implement the method in interface, click on the implementation class by forward navigation it will direct to the class builder, you can see the method to implement in the methods tab.
Implement the method by adding business functionality, the following is the implementation code.
Method zii_mi_s_in_sales_document_yh1~execute_synchronous.
types:
begin of type_sales_doc_res,
document_no type vbak-vbeln,
document_dt type vbak-erdat,
author_name type vbak-ernam,
doc_category type vbak-vbtyp,
doc_type type vbak-auart,
dev_blk type vbak-lifsk,
bill_blk type vbak-faksk,
netval type vbak-netwr,
sals_org type vbak-vkorg,
sold_party type vbak-kunnr,
end of type_sales_doc_res.
data:
fs_sales type type_sales_doc_res,
itab_sales like
table of
fs_sales.
data :
fs_out_res type zdt_sales_doc_res_details.
select vbeln
erdat
ernam
vbtyp
auart
lifsk
faksk
netwr
vkorg
kunnr
from vbak into table itab_sales
where vbeln = input-mt_sales_doc_req-document_no.
loop at itab_sales into fs_sales.
move-corresponding fs_sales to fs_out_res.
append fs_out_res to output-mt_sales_doc_res-details.
endloop.
endmethod.
In order to test this server proxy functionality, go to SPROXY transaction and select the Test Interface icon from toolbar as show in following figure.
2. Testing the Inbound ABAP Proxy
This will display the sender payload; you can edit the pay load and change the request parameter value and execute.
The resulting payload after service is the response from the inbound server proxy, you can see it in the following figure.
2 Comments
Subrahmanya (Shyam) Pindiproli
Significant Advantages of using PI Proxies :
Pavlo Astashonok
Why Consumer can't just directly call Proxy via endpoint without PI? Is it a security measure (not to expose backend to outside) or it has other concerns?