2006 Dec 20 3:09 PM
Hi,
I've a question related with call transformation.
I need to parse an XML file into an ABAP structure. I have the XML but I don't the ABAP structure. I wonder to know if there is an "automatic" way to define an ABAP structure (itab) from my xml file in order to store in it my XML file.
thanks in advance
Aaron
2006 Dec 20 3:11 PM
Check....
CEP_DOC_PARSE_XML_AND_SAVE
CEP_XSTRING_PARSE_XML_CLASS
Hi,
I've a question related with call transformation.
I need to parse an XML file into an ABAP structure. I have the XML but I don't the ABAP structure. I wonder to know if there is an "automatic" way to define an ABAP structure (itab) from my xml file in order to store in it my XML file.
thanks in advance
Aaron
2006 Dec 20 3:11 PM
Check....
CEP_DOC_PARSE_XML_AND_SAVE
CEP_XSTRING_PARSE_XML_CLASS
2006 Dec 20 4:06 PM
Thanks for your quick answer.
I don't know how to use, CEP_DOC_PARSE_XML_AND_SAVE. i think it's useless in this case. i can't find the way to give it my xml file.
I've tried CEP_DOC_PARSE_XML_AND_SAVE too, but it give me back an empty table. here is the code:
-
constants: srclen type i value 1024.
types: tsrclin(srclen) type x,
tsrctab type standard table of tsrclin.
data: file type string.
data srctab type tsrctab.
data st_srctab like line of srctab.
data strng_xml type xstring.
data: filelength type i.
data i_data like CHARACTERISTIC_VALS occurs 0.
data i_error like table of messages.
selection-screen begin of block b1.
parameters: p_path type localfile default 'D:\documentacion\MM\XML - XSLT\Invoice_5756.xml'.
selection-screen end of block b1.
file = p_path.
get XML
call function 'GUI_UPLOAD'
exporting filename = file
filetype = 'BIN'
importing filelength = filelength
tables data_tab = srctab
exceptions others = 1.
loop at srctab into st_srctab.
concatenate strng_xml st_srctab into strng_xml.
endloop.
CALL FUNCTION 'CEP_XSTRING_PARSE_XML_CLASS'
EXPORTING
pxstr_xml = strng_xml
tables
pt_classification = i_data
PT_ERROR_MSGS = i_error
EXCEPTIONS
PARSING_ERROR = 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.
-
could you help me with those FM???
many thanks
2006 Dec 20 4:25 PM
2006 Dec 20 8:47 PM
No, there is no automatic way. But you can use the classes in the IXML package in order to parse and render your xml into a DOM tree. From this you can create an ABAP structure by using the functionality of RTTI.
This has nothing to do with call transformation, since there you need an already existing DDIC structure.
Regards,
Thomas
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |