2008 Jul 23 11:35 AM
Hi all,
Could any one of you please tell me how to subtract Two NUMC values.
I have situation here is that
CASE counter.
WHEN '2'.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
WHEN '3'.
MOVE i_etxt-statxt TO wa_gtab-statxt2.
WHEN '4'.
MOVE i_etxt-statxt TO wa_gtab-statxt3.
WHEN '5'.
MOVE i_etxt-statxt TO wa_gtab-statxt4.
WHEN '6'.
MOVE i_etxt-statxt TO wa_gtab-statxt5.
ENDCASE.
ENDLOOP.
In the above code counter is of numeric data type and i need subtract like the below code
WHEN counter - '2'.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
Is it possible if so .. your views please
thanks in advance
regards
Vardhan
2008 Jul 23 11:41 AM
hi,
do this way ..
data : v_value(10) type n.
loop.
if counter co '0123456789'.
v_value = counter - 2.
endif.
WHEN v_value.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
......
endloop.
hi,
do this way ..
data : v_value(10) type n.
loop.
if counter co '0123456789'.
v_value = counter - 2.
endif.
WHEN v_value.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
......
endloop.
2008 Jul 23 11:41 AM
hi,
do this way ..
data : v_value(10) type n.
loop.
if counter co '0123456789'.
v_value = counter - 2.
endif.
WHEN v_value.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
......
endloop.
2008 Jul 23 11:41 AM
WHEN counter - '2'."this is wrong
try this:
WHEN counter - 2.
Amit.
2008 Jul 23 3:00 PM
Hi,
Check this sample code,
DATA:
w_temp(2) TYPE n.
w_temp = counter - 2.
LOOP AT <itab>.
CASE w_temp.
WHEN '2'.
MOVE i_etxt-statxt TO wa_gtab-statxt1.
WHEN '3'.
MOVE i_etxt-statxt TO wa_gtab-statxt2.
WHEN '4'.
MOVE i_etxt-statxt TO wa_gtab-statxt3.
WHEN '5'.
MOVE i_etxt-statxt TO wa_gtab-statxt4.
WHEN '6'.
MOVE i_etxt-statxt TO wa_gtab-statxt5.
ENDCASE.
ENDLOOP.Regards
Adil
2008 Jul 24 6:32 AM
Hi,,
We can subtract two numeric values directly...
that is the concept of Auotmatic type conversion..
data:
w_numc1(3) type n value '100',
w_numc2(3) type n value '084'.
* then u can directly subtract these two like this
w_numc1 = w_numc1 - w_numvc2.
or
w_numc1 = w_numc2 - 30.Regards,
Sunil Kumar Mutyala.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |