Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML to Internal Table with CDATA

AJeB
Participant
0 Likes
3,306

Hello,
Function Module: SMUM_XML_PARSE
I have an XML file and I want to upload it into ITAB, The upload was successful but it is not getting some values of the XML tags with CDATA,

sample XML tag with CDATA
<CompanyName><![CDATA[ABCD INC.]]></CompanyName> = Getting the data is not successful

<Location>Location 1</Location> = Getting the value is successful

How to fix this or What other FM I can use to get the XML value with CDATA ?

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
3,150

SMUM_XML_PARSE is just a "weakening" wrapper of IXML, so just copy its code and handle nodes of types CDATA (if_ixml_node=>co_node_cdata_section and if_ixml_cdata_section / method GET_VALUE to get directly "ABCD INC.")

5 REPLIES 5
Read only

junwu
SAP Champion
SAP Champion
0 Likes
3,150

use xslt......

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,150

As already answered in the forum: IXML, SXML, ST, XSLT, etc.

Read only

Sandra_Rossi
Active Contributor
3,151

SMUM_XML_PARSE is just a "weakening" wrapper of IXML, so just copy its code and handle nodes of types CDATA (if_ixml_node=>co_node_cdata_section and if_ixml_cdata_section / method GET_VALUE to get directly "ABCD INC.")

Read only

0 Likes
3,150

Thankyou ,
I coppied the FM and added this "if_ixml_node=>co_node_cdata_section" inside the get_element next to the "when if_ixml_node=>co_node_text" and I got the result I need.


and I also found other solution in this link
https://jjji35.tistory.com/111


Read only

3,150

"other solution in this link" which gives in fact code about if_ixml_node=>co_node_cdata_section, method get_value, which doesn't add much to the answer.

To help future visitors, I guess what you did in the copy of subroutine GET_ELEMENT of include LSMUMF01 (used by SMUM_XML_PARSE), is to change this:

    when if_ixml_node=>co_node_text.
to
    when if_ixml_node=>co_node_text
    or if_ixml_node=>co_node_cdata_section.