Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simple transformation file dropping trailing zero.

donna_verbonac2
Explorer
0 Likes
2,012

Hi experts.

I am having a problem with my transformation file, and I was hoping someone could help me.

I have created a simple transformation file, with a variable using the type of "DMBTR" which Does have 2 decimal points.

IF I have data - the two decimal points print.

EG if the amount is 100.57.. I get the 100.57 to print which is what I need and expect.

BUT.

IF the amount is 100.50 I am getting 100.5 Is is dropping the final zero amount, and therefore is failing in the validation.

HOW can I FORCE the two decimal points to print?

I have even tried it where I declare it as a variable of type "I" with 2 decimal points, and it still does not work.

I can not figure out how to use the Number format option with a Value-ref print line.

If someone could help me with that.. I could try that to see if it worked.

thank you.

eg: of the way the data is declared:

<tt:type name="GRTOT14" type="I" length="13" decimals="2"/>

OR

<tt:type name="GRTOT16" type="ddic:DMBTR"/>

<tt:type name="GRTOT17" type="ddic:DMBTR"/>

I have tried to change this to a string. and that will work. I DO get the 2nd decimal place shown even if it is a ZERO., but it fails on my validation of the file as this HAS TO BE Declared as a number with 2 decimal places.

PLEASE HELP.

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,279

From what I understand about XML (could be more), the canonical representation of decimal values does not allow a fixed number of decimal places.

SAP documentation:

http://help.sap.com/saphelp_nw04/helpdata/en/52/491a40251e2402e10000000a1550b0/frameset.htm

from there, this XML documentation is referenced:

http://www.w3.org/TR/xmlschema-2/#decimal

important bit:

Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero.

You already discarded my workaround: using a character or string type field and fill it to your liking prior to serialisation.

Thomas

3 REPLIES 3
Read only

ThomasZloch
Active Contributor
0 Likes
1,280

From what I understand about XML (could be more), the canonical representation of decimal values does not allow a fixed number of decimal places.

SAP documentation:

http://help.sap.com/saphelp_nw04/helpdata/en/52/491a40251e2402e10000000a1550b0/frameset.htm

from there, this XML documentation is referenced:

http://www.w3.org/TR/xmlschema-2/#decimal

important bit:

Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero.

You already discarded my workaround: using a character or string type field and fill it to your liking prior to serialisation.

Thomas

Read only

0 Likes
1,279

is there any way you can take a simple transformation file and create an XSLT with it?

Read only

Former Member
0 Likes
1,279

Hi Donna,

you can simple move your decimal value to a char variable and replace the things you want to replace.

After manipulation your have to remove the blanks. That worked form me.


var_chr = var_integer.

CONDENSE var_char NO-GAPS.

Regards, Christian