Press "Enter" to skip to content

ABAP Outbound Proxy: Add Link to Business Object

0

It is very useful to create a relationship between a business object (e.g. Sales Order) and the corresponding XI/PI Message (ABAP Proxy Runtime). As the message(s) are connected with the business object, it is not necessary to search the XML Message through the monitoring (although user-defined message search has also become very comfortable).


Sample Coding to link an outbound ABAP Proxy to a sales order:

        DATA: object_id TYPE sibflporb.
         object_id-instid = i_sales_order_id. "Instance ID
         object_id-catid  = 'BO'.      "BOR-Object
         object_id-typeid = 'BUS2032'. "BOR-Objecttype
 
         CALL METHOD cl_proxy_access=>write_outbound_message_link
           EXPORTING
             proxy     = l_proxy
             object_id = object_id.

This coding is executed AFTER calling the outbound proxy.

If the navigation does not work and the document type of the relationship is not “CL_SWF_XI_MESSAGE_LINK”, you have to apply SAP OSS note 1615098.


To see the relationships from the sales order it might be necessary to activate the display button:


Here´s a full example how to send a Sales Order from SAP ECC to PI/PO and link the outbound message to the object:

  1. Create a new Outbound Service Interface which is based on message type:

  2. Generate the ABAP Proxy (transaction SPROXY)

  3. Create an ABAP Program and execute it
REPORT z_mooc_salesorder_send.
 
 PARAMETERS: p_ord TYPE vbeln.
 
 DATA: lc_so_read       TYPE REF TO cl_sls_salesordererpidqr3,
       lc_so_send       TYPE REF TO zmoocco_sales_order_erpinforma,
       ls_so_read_query TYPE sls_sales_order_erpby_idquery4,
       ls_so_read_respo TYPE sls_sales_order_erpby_idresp65.
 
 ls_so_read_query-sales_order_erpby_idquery_syn-sales_order_erpselection_by_id-id-content = p_ord.
 
 TRY.
 * call synchronous inbound proxy to read Sales Order
     CREATE OBJECT lc_so_read.
     CALL METHOD lc_so_read->ii_sls_salesordererpidqr3~execute_synchronous
       EXPORTING
         input  = ls_so_read_query
       IMPORTING
         output = ls_so_read_respo.
 
 * call asynchronous outbound proxy to transfer Sales Order to PI/PO
     CREATE OBJECT lc_so_send.
     CALL METHOD lc_so_send->sales_order_erpinformation_out
       EXPORTING
         output = ls_so_read_respo.
 
     WRITE:/ 'Message sent'.
 
 * create object link
     DATA: object_id TYPE sibflporb.
     object_id-instid = p_ord.     "Sales Order #
     object_id-catid  = 'BO'.      "BOR-Object
     object_id-typeid = 'BUS2032'. "Sales Order
 
     CALL METHOD cl_proxy_access=>write_outbound_message_link
       EXPORTING
         proxy     = lc_so_send
         object_id = object_id.
 
     COMMIT WORK.
 
   CATCH cx_ai_system_fault .
     WRITE:/ 'Error sending message'.
 ENDTRY.
Print Friendly, PDF & Email