on 02-21-2006 10:29 AM
this is the code:
i get 100000 instead of 1,000.00
any idea?
thanks
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.
Hi Rani
Please try this code it will solve your problem.
DATA: v_var1 TYPE p DECIMALS 2 value '2000.65',
v_var2 TYPE p DECIMALS 2 value '1000.65',
v_var3 TYPE p DECIMALS 2.
v_var3 = v_var1 - v_var2.
write:/ v_var3.
Cheers
Kathir
Message was edited by: Kathirvel Balakrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is the hole code i send it to sapscript:
DATA: lv_sum type p decimals 2,
lv_sum_a type p decimals 2,
lv_mam type p decimals 2,
lv_sum_t(15)."type p decimals 2.
LOOP AT in_par.
CASE in_par-name.
WHEN 'MAM'.
REPLACE ',' WITH '' INTO in_par-value.
condense in_par-value no-gaps.
MOVE in_par-value TO lv_mam.
WHEN 'SUM'.
REPLACE ',' WITH '' INTO in_par-value.
condense in_par-value no-gaps.
MOVE in_par-value TO lv_sum_a.
ENDCASE.
ENDLOOP.
lv_sum = lv_sum_a - lv_mam.
lv_sum_t = lv_sum.
condense lv_sum_t.
LOOP AT out_par.
CASE out_par-name.
WHEN 'EXT_SUM'.
out_par-value = lv_sum_t.
ENDCASE.
MODIFY out_par.
ENDLOOP.
Hi rani,
use <b>write to</b> instead of
lv_sum = lv_sum_t.
ignore the edit mask if it doesn't work..
DATA: lv_sum type p decimals 2,
lv_sum_a type p decimals 2 value '2000.00',
lv_mam type p decimals 2 value '1000.00',
lv_sum_t(10) type c , m(7).
lv_sum = lv_sum_a - lv_mam.
<b>write lv_sum to lv_sum_t.</b>
you can debug and find the difference between using Write to and '='...
it will give you the desired result..
regards
satesh
DATA: v_var1 TYPE p DECIMALS 2 value '1020.65',
v_var2 TYPE p DECIMALS 2 value '20.65',
v_var3 TYPE p DECIMALS 2.
v_var3 = v_var1 - v_var2.
write:/ v_var3.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi rani,
if you want it to be a chracter field with comma..
then this code will do it..
data : a type p decimals 2 value '1020.00' , b type p decimals 2 value
'20.00' , c type i ,char(10) , m(7).
a = '1020.00'.
c = a - b .
*condense c.
write : / c decimals 2.
describe field c edit mask m .
write c to char using edit mask m.
write : / char.
try it out..
ps: reward points if it helps you..
regards
satesh
DATA: lv_sum type p decimals 2 ,
lv_sum_a type p decimals 2,
lv_mam type p decimals 2,
lv_sum_t(15)type i ."type p decimals 2,
lv_sum = lv_sum_a - lv_mam.
lv_sum_t = lv_sum.
condense lv_sum_t.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Again ..
please don't open many thread for the same question.
replace your : "lv_sum_t = lv_sum." with "write lv_sum to lv_sum_t".
Rgd
Frédéric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.