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 ABAP Transformatiom

nisha_vinod
Product and Topic Expert
Product and Topic Expert
0 Likes
422

Hello,

I have the following sample xml:

<SERVICE name="CreateContact">

<INPUT>

<ATTRIBUTE ATTRNAME="FNAME" type="freetext">Test</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="LNAME" type="freetext">Contact</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="DOB" type="date">30/12/1982</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="ROLE" type="Combo">BUP001</ATTRIBUTE>

</INPUT>

</SERVICE>

I need to convert this to an internal table , which looks like this:

Internal Table

-


FNAME : Test

LNAME : Contact

DOB : 30/12/1982

ROLE : BUP001

-


How can I achieve this using CALL Transformation?

Regards,

Nisha

Edited by: Nisha NC on Jul 7, 2008 2:06 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
396

hi

good

if you are not comfortable with XSLT do the following

1. read the xml into a string

2. convert the string to xstring using SCMS_STRING_TO_XSTRING

3. now use FM SMUM_XML_PARSE and pass the xstring xml_input parameter of that function.

this will parse the whole xml and give you an itab of element name value pairs which you can read easily

Refer

https://forums.sdn.sap.com/click.jspa?searchID=11194539&messageID=3788550

https://forums.sdn.sap.com/click.jspa?searchID=11194539&messageID=4164692

hope this will help you to solve your problem.

thanks

mrutyun^

Hello,

I have the following sample xml:

<SERVICE name="CreateContact">

<INPUT>

<ATTRIBUTE ATTRNAME="FNAME" type="freetext">Test</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="LNAME" type="freetext">Contact</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="DOB" type="date">30/12/1982</ATTRIBUTE>

<ATTRIBUTE ATTRNAME="ROLE" type="Combo">BUP001</ATTRIBUTE>

</INPUT>

</SERVICE>

I need to convert this to an internal table , which looks like this:

Internal Table

-


FNAME : Test

LNAME : Contact

DOB : 30/12/1982

ROLE : BUP001

-


How can I achieve this using CALL Transformation?

Regards,

Nisha

Edited by: Nisha NC on Jul 7, 2008 2:06 PM

1 REPLY 1
Read only

Former Member
0 Likes
397

hi

good

if you are not comfortable with XSLT do the following

1. read the xml into a string

2. convert the string to xstring using SCMS_STRING_TO_XSTRING

3. now use FM SMUM_XML_PARSE and pass the xstring xml_input parameter of that function.

this will parse the whole xml and give you an itab of element name value pairs which you can read easily

Refer

https://forums.sdn.sap.com/click.jspa?searchID=11194539&messageID=3788550

https://forums.sdn.sap.com/click.jspa?searchID=11194539&messageID=4164692

hope this will help you to solve your problem.

thanks

mrutyun^