Question:
I have a program which extracts data from an SAP Table (CAWN). 2 of the fields are defined as floating point (FLTP) -- The fields are ATFLV and ATFLB. This table/fields represent data from the Class Characterstics (CT04) in the values tab.
When I extract the data as floating point it will appear as 9.9900000000000006E+01
If I convert it to packed with 2 decimal places it will appear as 99.90
If I convert it to packed with no decimal places it will appear as 100.00 (it seems to round it up.
The actual value in the CT04 values tab is 99.9
I need the value to appear exactly the way it is in the values tab and these records vary in the # of decimal places. Some may have 2 decimal places while others may have 1 or even 3. Can anyone give me a suggestion as to how I can maintain the decimal places/numer exactly as it actually is in the values tab?
The current code I am using to convert the data types is:
DATA:
v_fromval(10) TYPE p decimals 2,
v_toval(10) TYPE p decimals 2.
*Loop through table and change from and to values from floating point to
*p (packed number) type
LOOP AT icawn.
MOVE icawn-atflv TO v_fromval. "From Value
MOVE icawn-atflb TO v_toval. "To Value
icawn-fromval = v_fromval. "From Value
icawn-toval = v_toval. "To Value
MODIFY icawn.
ENDLOOP.
Answer:
Function 'QSS0_FLTP_TO_CHAR_CONVERSION' works fine.
Regards,
Remus.