cancel
Showing results for 
Search instead for 
Did you mean: 

Store XML Payload inside ABAP table in binary format

Former Member
0 Kudos

Hi Experts,

I have a requiement where I need to store the XML Payload inside and ABAP table in binary format (in a single field) and then read the payload from the ABAP table again into standard XML and map it to a file structure for the file adapter to use.

Can you please tell me if you have had a similar requirement in the past and how you resolved it?

Thank you,

Brendon

Accepted Solutions (1)

Accepted Solutions (1)

former_member181962
Active Contributor
0 Kudos

Hi Brendon,

Is storing in Binary format a part of the requirement?

Can you store the data in string format?

Regards,

Ravi Kanth Talagaana

Former Member
0 Kudos

Hi Ravi,

I could store it as a string but since the payload is very large i.e greater than 4000 characters, I don't know if there is a data element in ABAP that will be able to hold that amount of data.

Regards,

Brendon

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

My approach would be is not to store the payload seperately since it is already stored in the ABAP tables.

You can get the message id dynamically in the mapping and retreive the payload from the ABAP table using the existing ABAP class/interface for that message id.

~SaNv....

Former Member
0 Kudos

Hi Santhosh,

Thanks for your repsonse. I thought of that approach using SXMB_READ_MESSAGE_VERSION_RAW or something similar, but the problem is that we only want to store the message if it meets certain critera (therefore if the message does not meet the criteria, it will not be stored in raw format inside ABAP).

Regards,

Brendon

santhosh_kumarv
Active Contributor
0 Kudos

Dear Brendon~

>>therefore if the message does not meet the criteria, it will not be stored in raw format inside ABAP

My point is XI stores the payload message in any case on ABAP tables for Monitoring & processing purpose...

instead of storing payload and retrieve it your requirement criteria you could only read the message from the standard table if it meets your criteria..

~SaNv..

Former Member
0 Kudos

Hi Santhosh,

What method would you use to map the xml in the ABAP table back to an xsd structure in the integration builder?

Regards,

Brendon

santhosh_kumarv
Active Contributor
0 Kudos

1. You have to read the payload using the abap code as below..

CALL METHOD persist_main->read_msg_all
      EXPORTING
        im_msgguid = <message id>
        im_pid     = <central>
        im_version = ' '
      IMPORTING
        ex_message = xms_msg_main.

*    xms_msg->deleteheaderbyname(
*           nsuri  = if_xms_run_time_env=>co_nsuri
*           lcname = if_xms_run_time_env=>co_lcname ).

    xmb_msg_main ?= xms_msg_main.


    CALL METHOD xmb_msg_main->if_xms_message_xmb~get_main_payloads
      RECEIVING
        return = payload.

    READ TABLE payload INTO wa_payload INDEX 1.

    CALL METHOD wa_payload-mainpayload->getbinarycontent
      RECEIVING
        return = content_main.

now content_main will have the payload.

2. You can parse this content using ABAP XML parser and return. This would be similar like ABAP Mapping

ixmlfactory = cl_ixml=>create( ).
      streamfactory = ixmlfactory->create_stream_factory( ).
      istream = streamfactory->create_istream_xstring( content_main ).
      idocument = ixmlfactory->create_document( ).
      iparser = ixmlfactory->create_parser( stream_factory =
      streamfactory
                                            istream = istream
                                            document = idocument ).
      iparser->parse( ).

~SaNv...

Answers (0)