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

Data Type Conversion

Former Member
0 Likes
576

Hello all,

I have one structure field AVG Data type is CHAR(25) .

In my program i took one local variable GV_AVG type F.

whwn i am trying to store the GV_AVG value into AVG It Stores like 1.23E+00

so My problem is i don't want that E+00 only 1.23.

would u please help me how can i solve this?

4 REPLIES 4
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
550

Hi,

First assign the value to NUMC(25) and then assing that to CHAR(25).

I think if you use NUMC you will loose '.'

One think you can do is use the command FIND to find 'E' and then you will get the position of it in sy-fdpos.

Then use it and extract the daya from you CHAR as follows

FIND 'E' in CHAR1.

if sy-subrc = 0.

CHAR1 = CHAR1+0(sy-fdpos).

endif.

Regards,

Sesh

Read only

Former Member
0 Likes
550

hi Vandana,

Use conversion_exit_alpha_input FM.

reward if help ful.

any querry reply.

Azad.

Read only

Former Member
0 Likes
550

Hi,

Check floating point checks in the attributes section..

Regards,

omkar.

Read only

amit_khare
Active Contributor
0 Likes
550

There is no fm for that, but you can use this syntax.

DATA: X TYPE P VALUE '123456789E2'.

WRITE: /X EXPONENT 0, "output: 12345678900,000000

/X(10) EXPONENT 0, "output: 1,235E+10

/X EXPONENT 3, "output: 12345678,90000000E+03

/Y EXPONENT -3, "output: 12345678900000,00E-03

/Y EXPONENT 9, "output: 12,34567890000000E+09

/Y EXPONENT 2

/Y DECIMALS 4. "output: 123456789,0000E+02

If you use exponent 0, you will get the numeric equivvalent of the scientific representation.

~ As found in forum

Regards,

Amit

Reward all helpful replies.