cancel
Showing results for 
Search instead for 
Did you mean: 

How to replace the root tag in ABAP Mapping

Former Member
0 Kudos

how to replace the root tag with the certain string in ABAP Mapping

just like

<?xml version="1.0" encoding="UTF-8"?>

<root>

<name>Lawrence</name>

</root>

into

<?xml version="1.0" encoding="UTF-8"?>

<myRootElement>

<name>Lawrence</name>

</myRootElement>

i don't want to implement it in message mapping

please give me the sample code

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

VijayKonam
Active Contributor
0 Kudos

Are you using DOM classes in your ABAP code? If so you need to create a new XML Message and then use the function CreateRoot then append the childs from the source message.

VJ

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos

Use below code

odocument = ixmlfactory->create_document( ).

msgtype = odocument->create_simple_element(

name = 'myRootElement'

parent = odocument ).

Thanks

Praveen