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: 

Moving a 4 decimal value to a 2 decimal value...

Former Member
0 Kudos
898

Please help move a 4 decimal amount to a 2 decimal amount...

8 REPLIES 8

GauthamV
Active Contributor
0 Kudos
436

Just declare the variable in which you are getting 4 decimals as

Data: var type p decimals 2.

Former Member
0 Kudos
436

hi.

check this code

data: dec1 type p DECIMALS 4,
dec2 type p decimals 2.

dec1 = '42.2222'.
write dec1.

dec2 = dec1.

write dec2.

Former Member
0 Kudos
436

HI,

Data : l_val1 TYPE P DECIMALS 4 value '10.1234'.
Data : l_val2 TYPE P DECIMALS 2 value .

l_val1 = l_val2.

Mohamed_Mukhtar
Active Contributor
0 Kudos
436

hi,

DATA : v1 TYPE p DECIMALS 4 VALUE '12345.6789',
       v2 TYPE p DECIMALS 2.

v2 = v1.
WRITE v2.
" ouptut  :  12,345.68

Thanks

Former Member
0 Kudos
436

data : lv1 type P DECIMALS 4,

LV2 TYPE PDECIMALS 2.

LV1 = 1234.5678

LV2 = LV1.

ANS : LV2=1234.56

Former Member
0 Kudos
436

Hi,

Declare the variable as

DATA : v1 TYPE p DECIMALS 2.

regards

Former Member
0 Kudos
436

Declare the varible with 2 decimal.

0 Kudos
436

Hi ,

Can we achieve the same by not using other variable of p decimals 2 .

I have to do with same variable by deleting the last 2 digits .how to go about it ??

Thanks .