cancel
Showing results for 
Search instead for 
Did you mean: 

Function to get message payload by MESSAGE_ID

Former Member
0 Kudos

Hello Experts,

Can you please give me the name of the function to get message payload by MESSAGE_ID?

I was trying to call SXMB_SELECT_MESSAGES, but it returnes just technical info about message (like sender, receiver, etc), but not the payload.

Thanks in advance for your answers!

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Check RFC:  SXMB_GET_MESSAGE_PAYLOAD. You have to know message id, PID and version (by default is 000).

Check CL_XMS_PERSIST class, you have lot of method to get latest version, get_PID...

former_member222684
Discoverer
0 Kudos

Hi guys,

I created a function  it can help you. just pass de request msgid.

FUNCTION zmf_pi_log_erro.

*"----------------------------------------------------------------------

*"*"Interface local:

*"  IMPORTING

*"     REFERENCE(I_MSGID) TYPE  STRING

*"  EXPORTING

*"     REFERENCE(E_ERRO) TYPE  STRING

*"     REFERENCE(E_TIPO) TYPE  STRING

*"----------------------------------------------------------------------

"Created By Clayton Fernandes -  clayton.fernandes@outlook.com.br

  DATA:         cl_system_fault       TYPE REF TO cx_ai_system_fault,

        cl_application_fault  TYPE REF TO cx_ai_application_fault,

        lo_payload_protocol   TYPE REF TO if_wsprotocol_payload,

        lo_payload            TYPE REF TO if_ws_payload,

        lo_protocol_messageid TYPE REF TO if_wsprotocol_message_id,

        lr_persist            TYPE REF TO cl_xms_persist,

        lr_error              TYPE REF TO cl_xms_msghdr30_error,

        lr_oref              TYPE REF TO cx_xms_syserr_persist.

  DATA:

        wa_output            TYPE  zmt_controle,

        wa_input             TYPE  zmt_controle_response,

        str_payload          TYPE c,

*      xstringa             TYPE string,

        l_sxmspmast          TYPE sxmspmast,

        l_sxmspvers          TYPE sxmspvers,

        lt_sxmspprop         TYPE sxmstprop,

        lt_sxmspres          TYPE sxmstres,

        lt_sxmspxres         TYPE sxmstxres,

        lt_sxmspns           TYPE sxmstns,

        vl_0001              TYPE sxmsmguid,

        tl_sxmsclup          TYPE  sxmsclup,

        tl_sxmspmast         TYPE  sxmspmast,

        string1              TYPE string.

  DATA:

      tl_string            TYPE TABLE OF string.

  FIELD-SYMBOLS:<fs_string1> LIKE LINE OF lt_sxmspprop.

  TRY.

      SELECT SINGLE * FROM sxmspmast INTO tl_sxmspmast WHERE ref_to_msg = i_msgid.

      IF sy-subrc = 0.

        SELECT SINGLE * FROM sxmsclup INTO tl_sxmsclup WHERE msgguid = tl_sxmspmast-msgguid.

      ENDIF.

      vl_0001 = tl_sxmsclup-msgguid.

      CREATE OBJECT: lr_persist,lr_error.

      CALL METHOD lr_persist->read_persist_tab_all_pub

        EXPORTING

          im_msgguid = vl_0001

          im_pid     = tl_sxmsclup-pid

          im_version = tl_sxmsclup-vers

          im_client  = tl_sxmsclup-mandt

        IMPORTING

          ex_pmast   = l_sxmspmast

          ex_pvers   = l_sxmspvers

          ex_tprop   = lt_sxmspprop

          ex_tres    = lt_sxmspres

          ex_txres   = lt_sxmspxres

          ex_tns     = lt_sxmspns.

    CATCH cx_xms_syserr_persist INTO lr_oref.

  ENDTRY.

  READ TABLE lt_sxmspprop ASSIGNING <fs_string1> WITH KEY lcname = 'Error'.

  IF  sy-subrc = 0.

    string1 = <fs_string1>-content.

    SPLIT string1 AT '<' INTO TABLE tl_string.

  ENDIF.

  FIELD-SYMBOLS: <fs_content> TYPE string.

  "pega erro quando for general

  READ TABLE tl_string ASSIGNING  <fs_content> INDEX 5.

  IF sy-subrc = 0.

    IF <fs_content>+24(7) = 'GENERAL'.

      e_tipo = <fs_content>+24.

      READ TABLE tl_string ASSIGNING  <fs_content> INDEX 11.

      IF sy-subrc = 0.

        e_erro = <fs_content>+19.

      ENDIF.

    ELSE.

      READ TABLE tl_string ASSIGNING  <fs_content> INDEX 17.

      IF sy-subrc = 0.

        e_erro = <fs_content>+10.

      ENDIF.

      READ TABLE tl_string ASSIGNING  <fs_content> INDEX 5.

      IF sy-subrc = 0.

        CONCATENATE <fs_content>+15(7) '-'  <fs_content>+24 INTO e_tipo.

      ENDIF.

    ENDIF.

  ENDIF.

ENDFUNCTION.

Former Member
0 Kudos

Hi,

To Retrieve the Message Payload Id...

Use the below UDF code

public String retrieveMsgID(String a,Container container){

String msgid;

java.util.Map map;

map = container.getTransformationParameters();

msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);

return msgid;

Thanks

Amaresh

Former Member
0 Kudos

Hello Amaresh, but I need the vice-versa solution: I need somehow to get payload(error description) by MESSAGE_ID.

Anyway, thanks for you answer!

henrique_pinto
Active Contributor
0 Kudos

sxmb_moni isn't that simple.

I works with nodekeys instead of using message_id as a key.

Also, it uses instantiated objects for the xml documents instead of plain table entries (for the main documents; for the header xmls they save it in tables). These objects instantiate the CL_XMS_RESOURCE class.

Check the RSXMB_DISPLAY_MSG_VERS_NEW report.

Search for the READ_AND_DISPLAY_DOCU2 form.

It may help you out.

Regards,

Henrique.

Former Member
0 Kudos

Hello Henrique,

Thanks a lot for your answer!

Do you know what functions does the web-based message monitor uses to get message information?

Former Member
0 Kudos

Thasnks for your answers!

Originally my task is to get System Error description about the failed message. I have a sync BPM with a Block element, which has Exception branch for handling System Errors during sync call, so my task is to provide a System Error description back to the Sender. Now I am tring to make a sync call to XI system to get this description, that is why I need some function which can provide this info.

Or maybe there are some other solutions for this case?

Former Member
0 Kudos

Hi,

May be u can try alert mechanism of XI.

Search on Alert on SDN.

Triggering from BPM.

/people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated

/people/community.user/blog/2006/10/16/simple-steps-to-get-descriptive-alerts-from-bpm-in-xi

chirag

Former Member
0 Kudos

Chirag, the problem is that the task is to provide much more specific message (containing a lot of business data) than the Alert Framework allow to provide.

That is why I am trying to build a custom response about System Error, which contains Error description and a lot of other info.

Former Member
0 Kudos

Hi,

Through alert u can raise message exception message, integration server and afdapter engine related errors, u can raise ur customer error message through mapping.

what message u want to raise can u give any example.

chirag

Former Member
0 Kudos

Chirag,

ok, here is the scenario: RFC<->XI<->SOAP. The IP address is dynamic (many dealers) and is defined by the field in incoming RFC. Sometimes there are problems with some dealers and that is causing System Errors during sync call to dealer. The System Error can be: Connection timeout, Connection refused, etc, and depending on this description different actions should be taken. That is why I need to provide this description back to the RFC.

So let's say I want to send an Alert containing IP address of the dealer and Error Description. Is this possible?

Former Member
0 Kudos

Hi,

If I understood your problem correctly, u need to raise a user defined e-mail or alert which will notify that an eror has occurred along with the data impacted. For this u can use

the following function module in your main mapping program and raise an alert accordingly. You can any number of the actual data field values in for of parameter to this function module which will then raise an alert according to the alert category defined in ur system.

SALERT_CREATE

Regards,

Akshay

Former Member
0 Kudos

Akshay, but the main (original) problem still remains: How I can get an access to System Error description (Connection timeout, Connction refused, etc)?

If I will build a custom Alert in my UDF and then will call SALERT_CREATE to raise an Alert, than how will I fill the Alert Body with Alert Description?

I can have either the "native" Alert, containing just the Alert Description or "custom" Alert, containing some business data. But I need both.

So is there any way to access the System Error description in mapping?

Former Member
0 Kudos

Hi,

If I understand correctly, you wwant the message payload for a particular MESSAGE_ID.

If this is so, then you need not use any function modules.

Go to SXMB_MONI -> Monitor for Processed XML messages

-> click on advanced search tab

there give your MSG_ID and execute

then you will get entry, from there you can take payload.

Regards.

Former Member
0 Kudos

Hi,

Refer the below function module SXMB_GET_MESSAGE_LIST

also refer the below link:

chirag