Application Development 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: 

simple qa-- a = b-c

Former Member
0 Kudos

i have B= 1,020.00

C= 20.00

i want a = 1<b>,</b>000

instead of that i get 1000.00

12 REPLIES 12

FredericGirod
Active Contributor
0 Kudos

1000.00 and 1,000.00 is the same thing.

you can use write and the mask option

or more simple write w_quantity_field to w_char_field and you will have the 1,000.00 (if your SU3 have the good settings)

Rgd

Frédéric

Former Member
0 Kudos

Hi rani,

1. For that just declare

a as integer.

data : a type i.

regards,

amit m.

abdul_hakim
Active Contributor
0 Kudos

Hi use the below code..

DATA: A1 TYPE P DECIMALS 2 VALUE '1020.00',

A2 TYPE P DECIMALS 2 VALUE '20.00',

A3 TYPE I.

A3 = A1 - A2.

WRITE A3.

Regards,

Abdul Hakim

0 Kudos

i tried and it's not work

this is the code:

DATA: lv_sum type i,

lv_sum_a type p decimals 2,

lv_mam type p decimals 2,

lv_sum_t(15) ."type p decimals 2,

lv_sum = lv_sum_a - lv_mam.

lv_sum_t = lv_sum.

condense lv_sum_t.

0 Kudos

try write lv_sum to lv_sum_t and not move ...

Former Member
0 Kudos

hi Rani,

declare a as type i field.

now you'll get the desired result ..

regards

satesh

0 Kudos

it;s worst i get 100000

and before i get 1000.00

i want to get 1,000.00

0 Kudos

hi Rani,

data : a type p decimals 2 value '1020.00' , b type p decimals 2 value

'20.00' , c type i.

c = a - b .

write : / c.

this gives 1,000 for me...

regards

satesh

0 Kudos

Hi Umbro,

You wont get the separator in char type field.

Close this thread if ur question has been answered.

Abdul

Former Member
0 Kudos

hi,

You can make use of REPLACE also.

REPLACE '.' IN quant WITH ','.

cheers

Sunny

Former Member
0 Kudos

This will solve it,

DATA: v_var1 TYPE p DECIMALS 2,

v_var2 TYPE p DECIMALS 2,

v_var3 TYPE p DECIMALS 0.

v_var1 = '1020.65'.

v_var2 = '20.65'.

v_var3 = v_var1 - v_var2.

write:/ v_var3.

Cheers

Kathirvel

0 Kudos

Hi Rani,

the following code will give an output of 1,000.00 as output..as desired by you..

data : a type p decimals 2 value '1020.00' , b type p decimals 2 value
'20.00' , c type i .

a = '1020.00'.
c = a - b .
write : / c decimals 2.

regards

satesh