2006 Apr 06 11:36 AM
hi frnd's.
Whether the IN condition can be used in the IF Statement.
Sample code is
IF W_data IN ('01', '02', '03', '04', '05', '15', '17', '20', '21', '22', '23' ).
I am getting an error incorrect logical expression.
2006 Apr 06 11:39 AM
Better is to play with ranges.
ranges : r_data for ...
move : 'I' to r_data-sign ,
'EQ' to r_data-option ,
'01' to r_data-low.
append r_data.
...
if w_data in r_data ..
2006 Apr 06 11:39 AM
2006 Apr 06 11:40 AM
Hello,
You can not use IF by this way..
simply fill one range by your values and then you can use this IF ...
IF w_data in R_data.
where r_data
r_data-sign = 'I'.
r_Data-options = 'EQ'.
r_data-low = '01'.
Regards,
Naimesh
PS: Reward points, if you find useful..!
2006 Apr 06 11:41 AM
Hi Suganya,
I think you can't use IN statement like the way you have used.
But u can create "select options" variable and compare it using IN statement.
Eg:
SELECT-OPTIONS S_CARRID FOR WA-CARRID.
IF 'LH' IN S_CARRID.
WRITE 'LH was selected'.
ENDIF.
Regards,
Sylendra
2006 Apr 06 11:45 AM
2006 Apr 06 11:43 AM
Hi
In condition can be used in IF statement but the statement where you want to use is worng.Check out the help of in in SAP help.I hope that will give your much idea to solve this problem.
Thanks
Mrutyunjaya Tripathy
2006 Apr 06 11:44 AM
2006 Apr 06 12:16 PM
Hi suganya
<b>You cannot use IN in IF variants.</b>
The correct code in your scenario would be
<b>IF WA_DATA EQ '01' OR
WA_DATA EQ '02' OR
WA_DATA EQ '03' OR
WA_DATA EQ '04' OR
WA_DATA EQ '05' OR
WA_DATA EQ '15' OR
WA_DATA EQ '17' OR
WA_DATA EQ '20' OR
WA_DATA EQ '21' OR
WA_DATA EQ '22' OR
WA_DATA EQ '23'.
ENDIF.</b>
Cheers,
Abdul Hakim
2006 Apr 06 12:43 PM
HI,
You cannot use IF with IN statement, You can use either AND or OR with IF statement.
regards
-Rakesh