‎2006 Nov 16 9:35 AM
morning,
i've got a xml-file in a string. how can i put the content of the string on the screen? if i set a breakpoint and try to watch the content in the debugger i only get 130 chars
second point is, how can i convert the xml-string to a abap structure?!?!
thx
‎2006 Nov 16 1:09 PM
hi Daniel,
Welcome to SDN.
to read the xml data to abap itab you could parse node by node or write a XSLT to map it to your itab or use the following method.
data: result_xml type standard table of smum_xmltb .
data: return type standard table of bapiret2 .
converting xml to itab
call function 'SMUM_XML_PARSE'
exporting
xml_input = xml
tables
xml_table = result_xml
return = return .
now check the result_xml itab.
Hope this helps.
Regards,
Richa
‎2006 Nov 16 10:01 AM
The best approach is to use the class CL_XML_DOCUMENT, which implements a DOM parser. Take a look at the PARSE_STRING and RENDER_2_TABLE methods.
For more info take a look at http://wiki.ittoolbox.com/index.php/Code:Download_and_upload_OO_ABAP_class_in_XML_format. It should give you enough example code to get started
MJ
‎2006 Nov 16 11:18 AM
ok, i got the xml text
<?xml version="1.0" encoding="UTF-8"?><MATMAS03><IDOC BEGIN="1"><EDI_DC40 SEGMENT="1"><TABNAM>EDI_DC40</TABNAM><MANDT>498</MANDT><DOCNUM>0000000000224113</DOCNUM><DOCREL>620</DOCREL><STATUS>30</STATUS><DIRECT>1</DIRECT><OUTMOD>2</OUTMOD><IDOCTYP>MATMAS03</IDOCTYP><MESTYP>MATMAS</MESTYP><SNDPOR>SAPCM3</SNDPOR><SNDPRT>LS</SNDPRT><SNDPRN>CM3CLNT498</SNDPRN><RCVPOR>MIELEPORT</RCVPOR><RCVPRT>LS</RCVPRT><RCVPRN>XMLTEST</RCVPRN><CREDAT>20061116</CREDAT><CRETIM>115459</CRETIM><SERIAL>20061116115458</SERIAL></EDI_DC40><E1MARAM SEGMENT="1"><MSGFN>018</MSGFN><MATNR>000000000000000121</MATNR><ERSDA>20061110</ERSDA><ERNAM>MKO1</ERNAM><LAEDA>20061116</LAEDA><AENAM>MKO1</AENAM><PSTAT>KVL</PSTAT><MTART>FERT</MTART><MBRSH>M</MBRSH><MEINS>PCE</MEINS><BLANZ>000</BLANZ><BRGEW>0.000</BRGEW><NTGEW>0.000</NTGEW><GEWEI>KGM</GEWEI><VOLUM>0.000</VOLUM><WESCH>0.000</WESCH><LAENG>0.000</LAENG><BREIT>0.000</BREIT><HOEHE>0.000</HOEHE><ERGEW>0.000</ERGEW><ERVOL>0.000</ERVOL><GEWTO>0.0</GEWTO><VOLTO>0.0</VOLTO><FUELG>0</FUELG><STFAK>0</STFAK><MHDRZ>0</MHDRZ><MHDHB>0</MHDHB><MHDLP>0</MHDLP><VPSTA>KVLZX</VPSTA><MSTDE>00000000</MSTDE><MSTDV>00000000</MSTDV><COMPL>00</COMPL><MTPOS_MARA>NORM</MTPOS_MARA><GEWTO_NEW>0.0</GEWTO_NEW><VOLTO_NEW>0.0</VOLTO_NEW><SLED_BBD>B</SLED_BBD><E1MAKTM SEGMENT="1"><MSGFN>004</MSGFN><SPRAS>D</SPRAS><MAKTX>Maschine XML 2 ABAP 9</MAKTX><SPRAS_ISO>DE</SPRAS_ISO></E1MAKTM></E1MARAM></IDOC></MATMAS03>
how can i transfer/convert this to an ABAP-itab???
‎2006 Nov 16 1:09 PM
hi Daniel,
Welcome to SDN.
to read the xml data to abap itab you could parse node by node or write a XSLT to map it to your itab or use the following method.
data: result_xml type standard table of smum_xmltb .
data: return type standard table of bapiret2 .
converting xml to itab
call function 'SMUM_XML_PARSE'
exporting
xml_input = xml
tables
xml_table = result_xml
return = return .
now check the result_xml itab.
Hope this helps.
Regards,
Richa
‎2006 Nov 16 1:19 PM
how can i check the result_xml table? if i set a breakpoint at the functioncall an trigger the next step, the debugger is gone.
i use this hole thing in an http request handler, so there is no real result to recognize
dit: XSLT would not be so good, because the structure could change from use to use
Message was edited by:
Daniel Aderhold
‎2006 Nov 20 7:35 AM
for testing purpose just after the call of the FM hard code a break point then you can check the result_xml in debugger
call function 'SMUM_XML_PARSE'
exporting
xml_input = xmldata
tables
xml_table = result_xml
return = return .
break-point .
please be aware that the xmldata has to be of type xstring, if you have your xml in string format you can convert to xstring using FM SCMS_STRING_TO_XSTRING
Regards
Raja
‎2006 Nov 20 4:23 PM
it worked fine. my failure was the missing transformation (string -> string).
now i have the next "problem"/question. i have some data in my abap program, maybe a string oder an itab. i want that data to be send to an external, non-sap system via SOAP.
how do i start the "transmission"???
regards daniel
‎2006 Nov 20 7:03 PM
Which version on SAP youare on?
i want that data to be send to an external, non-sap system via SOAP.
does the external system exposes a webservice to which you can send data? if yes get the wsdl (webservice discovery language) file from that system. once you have that file you can create a client proxy in SAP system to consume the webservice.
Regards
Raja