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

Numeric to PACKED field

Former Member
0 Likes
719

I have a field input_amount TYPE N ( Length is 12 , Last 2 digits represent decimal places )

How to convert this into a packed field. I have to use it for calculation.

example input_amount = 123456789012

the packed field should contain 1234567890.12

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
692

data : input_amount(12) type n,

l_temp type p decimals 2.

l_temp = input_amount<b> / 100.</b>

<b>and u will get output as 1234567890.12</b>

I have a field input_amount TYPE N ( Length is 12 , Last 2 digits represent decimal places )

How to convert this into a packed field. I have to use it for calculation.

example input_amount = 123456789012

the packed field should contain 1234567890.12

6 REPLIES 6
Read only

Former Member
0 Likes
692

data : l_temp type p decimals 2.

Read only

0 Likes
692

I already tried this.

when i move it directly ie

data : input_amount(12) type n,

l_temp type p decimals 2.

l_temp = input_amount

the output is 123456789012.00

I need 1234567890.12

Read only

0 Likes
692

have u tried concatinate? try this

Read only

Former Member
0 Likes
693

data : input_amount(12) type n,

l_temp type p decimals 2.

l_temp = input_amount<b> / 100.</b>

<b>and u will get output as 1234567890.12</b>

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
692

Hi,

Try


DATA: f_dat TYPE f VALUE '123456789012'.
DATA: p_dat(12) TYPE p DECIMALS 2.

p_dat = f_dat * '0.01'.
write: p_dat.

Regards,

Sesh

Read only

0 Likes
692

Thanks all