cancel
Showing results for 
Search instead for 
Did you mean: 

how to read data from the xml in pi

mrudularane
Explorer
0 Kudos

Hello Experts ,

I am having http to rfc asynchronous scenario . As scenario is asynchronous , third party is not able to understand whether all data  has come to pi or not . So we are thinking of writing a simple report(in se 38) in pi which will send a mail to third party people saying this are the order numbers which PI has received. For that we need to read data from the XMLs in sxmb_moni as order numbers are located inside xml . Can any one tell me how we can read xmls in abap language and use the data inside xml?

Regards ,

Mrudula

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Hi Mrudula,

Although your scenario is asynchronous http--> PI --> RFC, I hope third-party should still receive http status code e.g., 200 OK, 500 internal server error etc..and they could consider 200 OK as a successful message.

Regards,

Praveen Gujjeti

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Mrudula

In your abap program read the table 'SXMSPHIST' and find out the unique message id's that has been processed in PI.

Then take each message id and call the standard function module 'SXMB_GET_MESSAGE_PAYLOAD' to get the payload for that message id.

Sample code

CALL FUNCTION 'SXMB_GET_MESSAGE_PAYLOAD'

    EXPORTING

      im_msgkey      = ls_msgkey

      im_archive     = ' '

      im_version     = '000'

    IMPORTING

      ex_msg_bytes   = lv_bin_xml

    EXCEPTIONS

      not_authorized = 1

      no_message     = 2

      internal_error = 3

      no_payload     = 4

      OTHERS         = 5.

Once you have the payload xml, parse it to get the order number and then display the same in your report.

Hope this is clear.

Thanks,

Indrajit

iaki_vila
Active Contributor
0 Kudos

Hi Mrudula,

You can think also in to send the mail at mapping level or to use an RFC lookup for example to store the data that you want in your endpoint. Also, you can wrap your RFC destination with another RFC that had the same parameters that the wrapped and to add more data that you require like the PI origin.

Regards.

Former Member
0 Kudos

Hi Mrudula,

There is one other approach as well to intimate 3rd party that data arrived.

There are standard java services available ,just create consumer proxy in your abap system and get the data,Then you can provide the report to client as you want.

one such service is AdapterMessageMonitoringvi.you can select msg on various selection parameters

Regards

Naveen