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

[ISSUE] CALL TRANSFORMATION with FLOAT

Joseph_BERTHE1
Active Contributor
0 Likes
560

Hello,

I find something strange with the XML transformation. In fact, I have a field typed FLOAT with the value : '0.0053526555490249' and when I call the transformation I get the value : 0.0053526555490248998.


Try this code and tell me if you have the same issue :


TYPES: BEGIN OF l_typ_test,
          float     TYPE float,
        END OF l_typ_test.

DATA: l_str_test   TYPE l_typ_test,
       root         TYPE l_typ_test,
       l_var_output TYPE string.


l_str_test-float = '0.0053526555490249'.


CALL TRANSFORMATION id
                     SOURCE root = l_str_test
                     RESULT XML l_var_output.

WRITE l_var_output.

Result :


<?xml version="1.0" encoding="iso-8859-1" ?>

<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">

    <asx:values>

        <ROOT>

            <FLOAT>5.3526555490248998E-3</FLOAT>

        </ROOT>

    </asx:values>

</asx:abap>


If you have any suggestion to solve the issue, I'll be glad to know it

Kind Regards,

2 REPLIES 2
Read only

Former Member
0 Likes
514

You can use decfloat34 type instead of float as it is more precise.

The output would show correctly.

Read only

Former Member
0 Likes
514

Hi Joseph,

I think you  will use character type and move your floating value to cahr before moving in call transformation.

because after XML  conversion, field will bne consverted to XSTRING.

you can pass the char to XSTRING.

Regards,

Prasenjit