‎2008 Jun 17 6:42 PM
Dear experts,
In internal table , the following syntax whether correct or not.
IF( WS_CHANNEL IN ( '10','11') or ( ws_channel in ('50','60') and itab-loc = '4058')).
Please do the needful
Regards
R.Rajendran
‎2008 Jun 17 7:02 PM
It depends on what you want to do.
Currently the if statement is true for the following 4 scenarios.
- if ws_channel = 10
- if ws_channel = 11
- if ws_channel = 50 AND itab-loc = 4058
- if ws_channel = 60 AND itab-loc = 4058
Is that what you intend to do? If not please give a little more details on what your exact requirements are.
Thanks,
Michael
‎2008 Jun 17 7:06 PM
Dear michel,
i want to do the following two condition in the internal after population from the table.
1) ws_channel = 10 or 11 or 12 or 40
( without any other checking )
2) the above condition or
itab-loc = 4058 and ws_channel = 50 or 60
the above two condition should come in the single statement.
please do the needful.
Regards
R.Rajendran
‎2008 Jun 17 7:03 PM
Hello,
It's incorrect. The IN form that you used is valid only in SELECT commands.
You need to do like follows:
DATA:
lr_ws_channel LIKE RANGE OF ws_channel,
ls_ws_channel LIKE LINE OF lr_ws_channel.
ls_ws_channel-option = 'I'.
ls_ws_channel-sign = 'EQ'.
ls_ws_channel-low = '10'.
APPEND ls_ws_channel to lr_ws_channel.
ls_ws_channel-low = '20'.
APPEND ls_ws_channel to lr_ws_channel.
IF ( WS_CHANNEL IN LR_WS_CHANNEL )...
In you case you'll need two range tables.
I suggest you the following:
IF ( WS_CHANNEL = '10' OR WS_CHANNEL = '11' ) OR
( ( WS_CHANNEL = '50' OR WS_CHANNEL = '60' ) AND ITAB-LOC = '4058' ).
Regards.
‎2008 Jun 17 7:08 PM
Hi Rajender,
Yes this cannot be possible with the workarea. IN Operator is not allowd in the internal table.
Instead of passing the hardcoded value why dont you try with the Ranges.
Below is the sample program for you.
REPORT ZCC_TEST.
data: begin of it_final occurs 0,
matnr type mara-matnr,
end of it_final.
it_final-matnr = '101'.
append it_final.
it_final-matnr = '102'.
append it_final.
it_final-matnr = '103'.
append it_final.
it_final-matnr = '104'.
append it_final.
ranges: r_matnr for mara-matnr.
r_matnr-option = 'EQ'.
r_matnr-sign = 'I'.
r_matnr-low = '101'.
append r_matnr.
r_matnr-option = 'EQ'.
r_matnr-sign = 'I'.
r_matnr-low = '10'.
append r_matnr.
loop at it_final.
if it_final-matnr in r_matnr.
write:/ 'Found'.
endif.
endloop.
&******** Reward Point if helpful***********&
‎2008 Jun 17 7:11 PM
hi,
do this way ...
IF( ( WS_CHANNEL = '10' or WS_CHANNEL = '11' ) or
( ( ws_channel = 50 or ws_channel = '60') and itab-loc = '4058') ) ).
ENDIF.