cancel
Showing results for 
Search instead for 
Did you mean: 

Delete xml messagetype tag and xml versioning tag in target xml file

Former Member
0 Kudos

Hi experts.

i want to delete the xml version, starting (<MT_ZMPSSERRMSGMST_SEND>*and ending </MT_ZMPSSERRMSGMST_SEND> tags in below message.

here i am bold the tags which i want to delete. please help me how to delete this.

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

<MT_ZMPSSERRMSGMST_SEND>

<MESSAGE>

<TABLENAME/>

<ACTION/>

<RECORD>

<ERRORID/>

<ERRCLASSID/>

<SHORTDESC/>

<DESCRIPTION/>

<RESOLVE/>

</RECORD>

</MESSAGE>

</MT_ZMPSSERRMSGMST_SEND>

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Srinivas,

You can delete the required content of the XML by editing the XML.

Develop a custom adapter module and use the below code to edit the xml and deleting the highlighted content

// to read the input XML

strData = xmlData.getText();

// get the length of <?xml version="1.0"; encoding="UTF-8"?> <MT_ZMPSSERRMSGMST_SEND>

int strheaderlength = (strData.substring(0,strData.indexOf("<Message>")).length());

// read the data from <MESSAGE> to </MESSAGE>

String payload=strData.substring(strheaderlength,strData.startIndexOf("</MT_ZMPSSERRMSGMST_SEND>"))

// set the new payload to xmlData

xmlData.setText(payload);

appreciate if useful

udo_martens
Active Contributor
0 Kudos

Hi,

you need a NOT parsing mapping technology, coz a parser would automaticly create the prolog. Therefore only Java or ABAP.

Call in a ABAP mapping fm ECATT_CONV_XSTRING_TO_STRING to get a string, Delete that substrings as required with ABAP string operations (f.e. REPLACE) and call fm ECATT_CONV_STRING_TO_XSTRING to convert back to X-string.

Regards,

Udo

Former Member
0 Kudos

Hi,

you can achive it by XSLT mapping as step in your interface mapping.

Check thins thread: