Step-by-step guide to use Java and ABAP Proxies in a scenario

By Prasanna Krishna Mynam, Yash Technologies

Proxy Introduction:

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.  

Java Proxy Outbound and ABAP Proxy Inbound Implementation:  

The following figure illustrates the scenario synchronous java proxy as outbound which sends Sales Document Number request message to Integration Server using Messaging Service and ABAP proxy as synchronous inbound, which receives the request message from Integration Server and the ABAP proxy runtime processes and send the response.  


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.
    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.
        fs_sales type type_sales_doc_res,
        itab_sales like
        table      of
  data :
        fs_out_res type zdt_sales_doc_res_details.
  select vbeln
        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.
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.  


3. Generating Outbound JAVA Proxy          

Now the inbound server proxy (ABAP) is working fine, now we need to generate outbound client java proxy. In Integration Repository select the Outbound Message Interface and right click on it select the option Java Proxy Generation from the context menu.  

Click here to continue...


Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image