‎2009 Jan 27 10:55 AM
Guys,
I want to check the following condition.But the IN operator is giving error.Can any one help with this?
IF iest1-material(4) IN ('GH39' 'GH43' 'GH44' 'GH6' '6001').
‎2009 Jan 27 10:56 AM
‎2009 Jan 27 11:00 AM
Hi,
Give the IF condition as
IF iest1-material0(4) = 'GH39' OR iest1-material0(4) = 'GH43' OR iest1-material0(4) = 'GH44' OR iest1-material0(4) = '6001' .
Hope this helps you.
‎2009 Jan 27 11:04 AM
‎2009 Jan 27 11:07 AM
Hi
U can't use that control in a IF condition, u need to use a RANGE instead of an explicit range:
DATA: BEGIN OF MY_RANGE OCCURS 0,
SIGN(1) TYPE C,
OPTION(2) TYPE C,
LOW(4) TYPE C,
HIGH(4) TYPE C,
END OF MY_RANGE.
MY_RANGE(3) = 'IEQ'.
MY_RANGE-LOW = 'GH39'.
APPEND MY_RANGE.
MY_RANGE-LOW = 'GH43'.
APPEND MY_RANGE.
MY_RANGE-LOW = 'GH44'.
APPEND MY_RANGE.
MY_RANGE-LOW = 'GH6'.
APPEND MY_RANGE.
MY_RANGE-LOW = '6001'.
APPEND MY_RANGE.
IF iest1-material(4) IN MY_RANGE.
ENDIF.Max
‎2009 Jan 27 11:07 AM
‎2009 Jan 27 11:09 AM
hi,
if this is not working, try insert into one range table.then do IN rabge table.this will defenitely work
‎2009 Jan 27 11:18 AM
Hi, Alka
Test the following code i am using Range here insted of if, i have tested it is working fine.
TYPES: BEGIN OF t_it,
mat(6),
END OF t_it.
DATA: it TYPE STANDARD TABLE OF t_it WITH HEADER LINE,
number TYPE i VALUE '1001'.
RANGES: rtest FOR it-mat.
rtest-sign = 'I'.
rtest-option = 'EQ'.
rtest-low = '1001'.
APPEND rtest TO rtest.
rtest-low = '1002'.
APPEND rtest TO rtest.
rtest-low = '1003'.
APPEND rtest TO rtest.
DO 10 TIMES.
it-mat+0(4) = number.
ADD: 1 TO number.
APPEND it TO it.
ENDDO.
LOOP AT it INTO it.
IF it-mat+0(4) IN rtest.
WRITE: / 'In the Range ', it-mat.
ELSE.
WRITE: / 'Not In the Range ', it-mat.
ENDIF.
ENDLOOP.Please Reply if any thing else,
Kind Regards,
Faisal
‎2009 Jan 27 1:36 PM
guys ,
I am declaring Ranges as follows: It go into dump and shows error at:
IF NOT iest1-material(temp_len) IN MAT_RANGE.
Code:
RANGES MAT_RANGE FOR ZEST1-MATERIAL.
MAT_RANGE-LOW = '04'.
APPEND MAT_RANGE.
MAT_RANGE-LOW = '05'.
APPEND MAT_RANGE.
MAT_RANGE-LOW = '06'.
APPEND MAT_RANGE.
LOOP AT itab_zwst43.
CLEAR : temp_len.
temp_len = strlen( itab_zwst43-material ).
IF iest1-material(temp_len) EQ itab_zwst43-material.
IF temp_type_parts IS INITIAL OR
itab_zwst43-lab_type1(1) > temp_type_parts1(1).
MOVE itab_zwst43-lab_type TO temp_type_parts.
ENDIF.
EXIT.
ELSE.
IF NOT iest1-material(temp_len) IN MAT_RANGE.
IF temp_type_parts IS INITIAL.
temp_type_parts = 'L1'.
ENDIF.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
Please guide
‎2009 Jan 27 1:39 PM
Use
IF iest1-material(temp_len) NOT IN MAT_RANGE.
Regards,
Prashant
‎2009 Jan 27 1:47 PM
Hi, Alka,
Just try to replace the following line of code in my above code.
IF it-mat+0(4) IN rtest. " Now you have to writ like this IF it-mat+0(4) NOT IN rtest.Please Reply if any Problem,
Kind Regards,
Faisal
‎2009 Jan 27 2:04 PM
Hi,
You also need to assign the values for the sign and option fields of the range.
mat_range-sign = 'I'.
mat_range-option = 'NE'. " Use Not equal to operator
MAT_RANGE-LOW = '04'.
APPEND MAT_RANGE.
MAT_RANGE-LOW = '05'.
APPEND MAT_RANGE.
MAT_RANGE-LOW = '06'.
APPEND MAT_RANGE.
.....
IF iest1-material(temp_len) IN MAT_RANGE. " Use this line.
regards,
Advait
‎2009 Jan 27 4:48 PM
Hi Alka,
Hope this should be helpful.
IF iest1-material+0(4) = 'GH39'
OR iest1-material+0(4) = 'GH43'
OR iest1-material+0(4) = 'GH44'
OR iest1-material+0(4) = '6001' .
-
ENDIF.
Regards
Sravan