Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9159

Re: HTTP Adapter help. Editing payload on a receiver Http message

$
0
0

HI ,

 

The code I have written to change the tag name from XML to PMLXML is as below .

 

 

   DATA: lv_xml type string.
DATA: lv_xmldata TYPE xstring.
DATA: lt_xml_info TYPE TABLE OF smum_xmltb.
DATA: lwa_xml_info LIKE LINE OF lt_xml_info.
DATA: lt_bapireturn type table of BAPIRET2.
DATA: lv_xmlout type xstring.
DATA: lv_finalout type string.
DATA: lv_content   TYPE string.


lv_xml = server->request->get_cdata( ).

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
   EXPORTING
     TEXT           = lv_xml
*   MIMETYPE       = ' '
*   ENCODING       =
  IMPORTING
    BUFFER         = lv_xmldata
  EXCEPTIONS
    FAILED         = 1
    OTHERS         = 2
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'SMUM_XML_PARSE'
   EXPORTING
     XML_INPUT       = lv_xmldata
   TABLES
     XML_TABLE       = lt_xml_info
     RETURN          = lt_bapireturn
           .


loop at lt_xml_info into lwa_xml_info where CNAME = 'XML' .

lwa_xml_info-CNAME = 'pmlxml'.

modify lt_xml_info from lwa_xml_info.

endloop.


CALL FUNCTION 'SMUM_XML_CREATE_X'
  IMPORTING
    XML_OUTPUT       = lv_xmlout
   TABLES
    XML_TABLE        = lt_xml_info
           .

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
   EXPORTING
     IM_XSTRING        = lv_xmlout
*   IM_ENCODING       = 'UTF-8'
  IMPORTING
    EX_STRING         = lv_finalout
           .

server->request->set_cdata( lv_finalout ).


I need to do exact opposite of this before sending the data out to the target SAP system.


Thanks

Nikhil


Viewing all articles
Browse latest Browse all 9159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>