cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove leading Zeroes in all fields in Payload

Former Member
0 Kudos

Hi,

How can I remove the leading Zeroes in every Filed I have in whole Payload Structure.there are around 10000 fields that have to be removed the leading Zeroes.any good idea please.

<POSNR>000010</POSNR>

<MATNR>000002465640</MATNR>

<ARKTX>000012 KG D107</ARKTX>

<MATKL>00030010000</MATKL>

<WERKS>0000ORGC</WERKS>

<LGORT>0000GC55</LGORT>

<CHARG>000TEST</CHARG>

like this mutliple segments and multiple Fields.so I can take as whole payload with multiple fields should not have leading Zeroes.I can handle if they are 10 0r 20 fileds,but not like whole pay load/1000 fields right.

thank you,

Prem

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

You can have an additional XSLT mapping, to your existing one..

use copy-of & apply-templates to copy the whole tree & make changes recursively.

below is a sample code , the marked line is where you need to try your logic of trimming Zeros. (this code does upper case)

add this below code in your interface mapping object, as XSLT mapping, which does the job (only try putting your logic)

<xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

version="2.0">

<xsl:output method="xml"

indent="yes"

omit-xml-declaration="yes"/>

<xsl:template match="*">

<xsl:copy>

<xsl:copy-of select="@*"/>

<xsl:apply-templates/>

</xsl:copy>

</xsl:template>

<xsl:template match="text()">

<xsl:value-of select="upper-case(.)"/>

</xsl:template>

</xsl:stylesheet>

hope this fixes your issue

Regards

Vishnu

Former Member
0 Kudos

Hi Prem,

You can use the FormatNumber function to remove the leading zeros. But this is to be used for each individual field.

Regards,

Hari.

Former Member
0 Kudos

Yes I know.but I am looking for whole payload fields.

thank you for your response.

VijayKonam
Active Contributor
0 Kudos

I do not think there is a readymade function available. You might have to use Java mapping. But going with the format function as suggested would be easier even it might consume little time..!!

VJ

Former Member
0 Kudos

hmm..but will take longer for 1000 fields..but not a good idea for me.

thank you.