Application Development 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: 

Data Type

Former Member
0 Kudos

Can someone tell me,

how we can convert the 1.9500000000000001E-01 to Numeric Value?

Thanks,

Archana.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

plz check the below code :

data : w_float type f value '3.339000000000000E+02',
w_character type ausp-atwrt,
w_number(10) TYPE P DECIMALS 1.

CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = w_float "Feld TYPE F
format_imp = w_number "Field Format
round_imp = ' ' "Round off
IMPORTING
char_exp = w_character. "Feld TYPE C

Write : w_character.

Output : 333.9

thanx.

5 REPLIES 5

Former Member
0 Kudos

Simply assign this F type variable to a P type varaible:


DATA: num1 TYPE F VALUE '1.95E-01',
           num2 TYPE P DECIMALS 3.
                                                                        
num2 = num1.
                                                                        
WRITE: / num2.

Just make sure you target variable is properly defined to accomodate the exponential or else it will dump

You can also use FM: CEVA_CONVERT_FLOAT_TO_CHAR

If you search the forum you will get more solutions.

Former Member
0 Kudos

Hi Archana,

Use the function module :

CEVA_CONVERT_FLOAT_TO_CHAR

Check this sample:

CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
  EXPORTING
    float_imp  = w_float             -->Feld TYPE F
    format_imp = w_number      -->Field Format
    round_imp  = ' '                   -->Round off
  IMPORTING
    char_exp   = w_character.    -->Feld TYPE C

Regards,

Chandra Sekhar

narin_nandivada3
Active Contributor
0 Kudos

HI,

You can do this way...

Data:

float type f,

pack type p decimals(2).

give that value to the float and assign it to pack...

Pack = float.

or else if you want that value into character the use the function module to convert the float value

to decimal.

Please check this thread

You can also use FLTP_CHAR_CONVERSION.

And once if you convert to char then assign that to numeric variable so that to get a value into

numeric variable.

Hope this would help you.

Good luck

Narin

Former Member
0 Kudos

hi,

check this out it will help you:

regards

rahul sharma

Former Member
0 Kudos

Hi,

plz check the below code :

data : w_float type f value '3.339000000000000E+02',
w_character type ausp-atwrt,
w_number(10) TYPE P DECIMALS 1.

CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = w_float "Feld TYPE F
format_imp = w_number "Field Format
round_imp = ' ' "Round off
IMPORTING
char_exp = w_character. "Feld TYPE C

Write : w_character.

Output : 333.9

thanx.