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

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

Former Member
0 Kudos
1,014

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

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Kudos
552

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

Data: var type p decimals 2.

Read only

Former Member
0 Kudos
552

hi.

check this code

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

dec1 = '42.2222'.
write dec1.

dec2 = dec1.

write dec2.

Read only

Former Member
0 Kudos
552

HI,

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

l_val1 = l_val2.

Read only

Mohamed_Mukhtar
Active Contributor
0 Kudos
552

hi,

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

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

Thanks

Read only

Former Member
0 Kudos
552

data : lv1 type P DECIMALS 4,

LV2 TYPE PDECIMALS 2.

LV1 = 1234.5678

LV2 = LV1.

ANS : LV2=1234.56

Read only

Former Member
0 Kudos
552

Hi,

Declare the variable as

DATA : v1 TYPE p DECIMALS 2.

regards

Read only

Former Member
0 Kudos
552

Declare the varible with 2 decimal.

Read only

0 Kudos
552

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 .