Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Simple routine to convert exponential values to float

$
0
0

Dear all,

 

I was trying to get values in an ALV grid recently and I noticed that the values are displayed as exponential values which didn't satisfy the client very much. So after a little research I found this function module that converted the exponential format to float format.

 

This form takes the exponential value in V_FLOAT variable converts it to the float value in V_CHAR P10_4 variable

 

FORM CONVERT CHANGING V_FLOAT V_CHAR P10_4.

   IF V_FLOAT IS NOT INITIAL.

 

   CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'

   EXPORTING

     FLOAT_IMP  = V_FLOAT

     FORMAT_IMP = P10_4

     ROUND_IMP  = ' '

  IMPORTING

    CHAR_EXP = V_CHAR.

  ENDIF.

ENDFORM.

 

 

DATA: V_FLOAT TYPE F , V_CHAR(25), P10_41(10) TYPE P DECIMALS 3.     "CONVERSION OF STRING TO FLOAT STRUCTURE.

 

V_FLOAT = VALUE_BEFORE_CONVERSION.

PERFORM CONVERT CHANGING V_FLOAT V_CHAR P10_41.

VALUE_AFTER_CONVERSION  = V_CHAR.

 

 

Hope this simple routine is useful.

 

If you have any doubts, please don't hesitate to ask.

 

Regards,

Mohammed Mohsen


Viewing all articles
Browse latest Browse all 935

Latest Images

Trending Articles



Latest Images