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

convert from exponential to normal integer

Former Member
0 Likes
3,552

Hi Friends,

Can you please help me suggesting the solutions for

conversion from format say

<b>1E+02 to 100</b>

Please suggest any conversion function modules or standard solutions for the same

Thank you

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
1,795

Check this routine -

data: a type string value '10E+02'.

data: b type f.

data: c type p.

b = a.

c = b.

write:/ b, c.

Hope this will help you.

Regards,

Amit

5 REPLIES 5
Read only

amit_khare
Active Contributor
0 Likes
1,795

Welcome to SDN.

Check these FMs -KKEK_CONVERT_FLOAT_TO_CURR &

CHAR_FLTP_CONVERSION .

As an alternative just assign the value to type P variable and check.

Regards,

Amit

Reward all helpful replies.

Read only

0 Likes
1,795

Hi Amith,

actually i have the a character string as

a = 1E+02

it cant be changed to packed number.

i tried using the fm sent by you CHAR_FLTP_CONVERSION.

but it did not help

now the thing the character string 'a' to an integer say 100.

Could you help me now regarding this

Read only

Former Member
0 Likes
1,795

Hello,

if you want to calculate the value use the following

    • : Exponentiation of the left with the right operand.

Example:

value = 2 ** 3.

value will have 8.

Hope this is what you need

Gabriel

Read only

ferry_lianto
Active Contributor
0 Likes
1,795

Hi,

No need FM, you can just move field with type F to type P.


DATA: NUM1 TYPE F VALUE '1E+02',
      NUM2 TYPE P DECIMALS 2.
                                                                        
NUM2 = NUM1.
                                                                        
WRITE: / NUM2.

Regards,

Ferry Lianto

Read only

amit_khare
Active Contributor
0 Likes
1,796

Check this routine -

data: a type string value '10E+02'.

data: b type f.

data: c type p.

b = a.

c = b.

write:/ b, c.

Hope this will help you.

Regards,

Amit