cancel
Showing results for 
Search instead for 
Did you mean: 

Structure to string conversion

Former Member
0 Kudos

Hi Folks,

I have a requirement to send the whole XML as one string. I also refered the wiki [https://wiki.sdn.sap.com/wiki/display/Snippets/JavaMapping-ConverttheInputxmltoString|https://wiki.sdn.sap.com/wiki/display/Snippets/JavaMapping-ConverttheInputxmltoString] The below is the example of the source and target xml. But here inside the java mapping they have hard coded the file location but in my case it a proxy to soap scenario. Kindly give me some idea so that I can do it.

Source XML

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

- <ns0:MT_Emp_Det xmlns:ns0="http://yash.com/YH203/file2file_abapmapping">

- <EMPLOYEE>

- <PERSONAL>

<EMPID>001</EMPID>

<FIRSTNAME>Santosh</FIRSTNAME>

<MIDDLENAME>Kumar</MIDDLENAME>

<LASTNAME>K</LASTNAME>

<AGE>25</AGE>

<GENDER>M</GENDER>

</PERSONAL>

- <PERSONAL>

<EMPID>002</EMPID>

<FIRSTNAME>Bala</FIRSTNAME>

<MIDDLENAME>Krishna</MIDDLENAME>

<LASTNAME>Reddy</LASTNAME>

<AGE>25</AGE>

<GENDER>M</GENDER>

</PERSONAL>

</EMPLOYEE>

</ns0:MT_Emp_Det>

Target XML

<?xml version="1.0" encoding="UTF-8" ?><ns0:MT_Emp_Det xmlns:ns0="http://test.com"><EMPLOYEE><PERSONAL><EMPID>001</EMPID><FIRSTNAME>Santosh</FIRSTNAME><MIDDLENAME>Kumar</MIDDLENAME><LASTNAME>K</LASTNAME><AGE>25</AGE><GENDER>M</GENDER></PERSONAL><PERSONAL><EMPID>002</EMPID><FIRSTNAME>Bala</FIRSTNAME><MIDDLENAME>Krishna</MIDDLENAME><LASTNAME>Reddy</LASTNAME><AGE>25</AGE><GENDER>M</GENDER></PERSONAL></EMPLOYEE></ns0:MT_Emp_Det>

Regards,

Santosh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

check the below blog!

https://wiki.sdn.sap.com/wiki/display/Snippets/JavaMapping-ConverttheInputxmltoString

Regards

Ramg

Former Member
0 Kudos

Hi Santosh,

> I have a requirement to send the whole XML as one string. The below is the example of the source and target xml. Kindly give me some idea so that I can do it.

In the mapping write one simple UDF for concatenating all the fields and map to the target variable.

Regards

Ramesh