Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
13,429

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

1 Comment
Labels in this area