cancel
Showing results for 
Search instead for 
Did you mean: 

how to include a line feed at the end of each tag at mapping level

Former Member
0 Kudos

Hi Experts,

how to include a line feed at the end of each tag at mapping level in our sap pi.

i am getting the out put like this............

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

<ns1:CustomerBalances xmlns:ns1="http://abc.com/xi/LEGACY/OTC/IF0285_CustOpenBal/1200"><Customer><CustomerNo>1234</CustomerNo><Balance>12.00-</Balance></Customer></ns1:CustomerBalances>

My required out put format is like this......i want the out put like below format

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

<ns1:CustomerBalances xmlns:ns1="http://abc.com/xi/LEGACY/OTC/IF0285_CustOpenBal/1200">

  <Customer>

    <CustomerNo>1234</CustomerNo>

    <Balance>12.00</Balance>

  </Customer>

</ns1:CustomerBalances>

How can i achive this .please help me

Thanks & Regards,

Bhaskar



Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I donnot what is the filename extension.

But try to change to .xml and let client open it with IE.

you will get the 2nd format.


Former Member
0 Kudos

Hi all,

please provide me java code for java mapping as per my requirement (Carriage return or line feed in the end of each line of xml file ). my client wants java mapping.

My required out put format is like this......i want the out put like below format

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

<ns1:CustomerBalances xmlns:ns1="http://abc.com/xi/LEGACY/OTC/IF0285_CustOpenBal/1200">

  <Customer>

    <CustomerNo>1234</CustomerNo>

    <Balance>12.00</Balance>

  </Customer>

</ns1:CustomerBalances>

Thanks,

Bhaskar

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I suspect problem is with the editor you are using to open like notepad. You don't need to do anything. you can try other tools like xmlspy or browser and see how that displays.

Former Member
0 Kudos

Hi Bhaskar Gopal,

actually my out put file is going to client they are reading that file some how.....

and they ask me can i provide the out put as i mentioned earlier .......they are saying it is easy to process that file if carriage return after each  tag.

i thought of going to xslt mapping at last but now, is there any other option with out xslt or java mapping.....

Thanks,

Bhaskar

Former Member
0 Kudos

Bhaskar,

It seems there might be an issue/limitation with the receiver XML parser. They should be able to process the XML as it is.

Having said that i faced similar problem with one of my interfaces earlier.

What i did was -

1) First Step use normal mapping.

2) Use XSLT mapping which would do the line feed. You can use Stylus studio to help you with the XSLT mapping.

Regards,

Sumit

Former Member
0 Kudos

Hello Bhaskar,

Both messages will be same process result. You don't need to format XML like that. I mean, if data between tag are same, you'll have same runtime result

Anyway, you can't have the result you want with graphical mapping, use JAVA or XSLT but I'm not sure you need to do that.

Kind Regard,

Guislain

Former Member
0 Kudos

Hi Guislain,

My scenario is PROXY  To  XMLFILE

with out java mapping and xslt mapping is there any option in our SAP PI.

for "Add new line in end of each tag"  at mapping level.

Thanks,

Bhaskar 

Former Member
0 Kudos

Bhaskar,

As my knowledge, you can't use UDF, or module option.

I think it's easier with XSLT mapping after your mapping.

Take a look a this XSL tuto

http://www.w3schools.com/xsl/xsl_for_each.asp

Regard,

Guislain

Former Member
0 Kudos

Hi,

The final generated XML file will be in the desired format u dont have to do anything.

From where u have pasted the above output? If i am not wrong u have taken the above format from the source text view under mapping test tab??

Thanks

Amit Srivastava