cancel
Showing results for 
Search instead for 
Did you mean: 

Acknowledgements at the time of client proxy

Former Member
0 Kudos

Hi All,

I am working Proxy to Jms. I am sending the 100 records at a time. Here the SAP system should receiver the status of each and every message whether the message is successfull send or not. Can any one please help me how can i do this?

Thanks & Regards

Karthik

Accepted Solutions (1)

Accepted Solutions (1)

jyothi_anagani
Active Contributor
0 Kudos

Hi,

Refer This.

/message/660785#660785 [original link is broken]

Thanks.

Answers (2)

Answers (2)

Former Member
0 Kudos
prasannakrishna_mynam
Contributor
0 Kudos

Hi Karthikeya,

There is a interface avalable named IF_WSPROTOCOL_ASYNC_MESSAGING, Create reference for this interface in your report program. Check the example given below.

Method sendWithACK.
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,
 lo_async_messaging TYPE REF TO if_wsprotocol_async_messaging,
 lo_msg_id_protocol TYPE REF TO if_wsprotocol_message_id,
 l_msg_id           TYPE SXMSGUID,
 l_ack_request      TYPE PRX_ACK_REQUEST_DETAILS.

* Structures to set and get message content
 ls_request         TYPE [Output Message Type],

TRY.

* create proxy client

  CREATE OBJECT lo_clientProxy.

* get protocol for asynchronous messaging

  lo_async_messaging ?= 
   lo_clientProxy->get_protocol( if_wsprotocol=>async_messaging ).

* Ask for transport acknowledgment

  clear l_ack_request.
  l_ack_request =
    IF_WSPROTOCOL_ASYNC_MESSAGING=>CO_TRANSPORT_ACKNOWLEDGMENT.
  lo_async_messaging->set_acknowledgment_requested( l_ack_request ).

* do asynchronous client proxy call

  CALL METHOD lo_clientProxy->execute_asynchronous
     EXPORTING output  = ls_request.

* get message id of sent message

  lo_msg_id_protocol ?= 
    lo_clientProxy->get_protocol( if_wsprotocol=>message_id ).
  l_msg_id = lo_msg_id_protocol->get_message_id( ).

* send message

  COMMIT WORK.

  CATCH cx_ai_system_fault INTO lo_sys_exception.

*   Error handling

ENDTRY.

* Somehow pass the message ID to the caller for an evaluation
* at a later point in time

Return lo_msg_id.

Endmethod.

Querying an Acknowledgment
You can query the acknowledgment object later by using the message ID:

Data:

lo_ack                   TYPE REF TO if_ws_acknowledgment,
l_ack_status_simple type PRX_ACK_STATUS,
l_ack_status_detail type PRX_ACK_STATUS_DETAIL_TABLE.

* read ack
lo_ack = cl_proxy_access=>get_acknowledgment( l_msg_id ).
l_ack_status_simple = lo_ack->get_status( ).
l_ack_status_detail = lo_ack->get_status_detail( ).

You can query the acknowledgment object later by using the message ID:

Data:

lo_ack                   TYPE REF TO if_ws_acknowledgment,
l_ack_status_simple type PRX_ACK_STATUS,
l_ack_status_detail type PRX_ACK_STATUS_DETAIL_TABLE.

* read ack
lo_ack = cl_proxy_access=>get_acknowledgment( l_msg_id ).
l_ack_status_simple = lo_ack->get_status( ).
l_ack_status_detail = lo_ack->get_status_detail( ).