‎2006 Jul 07 4:01 PM
Hi,
I need to check the select-options values using the internal table.
ex.
loop at itab.
check itab-from not between field-high and field-low.
if sy-subrc eq 0.
write : 'OK'.
else.
write : 'not OK'.
endif.
Please I need exact code for this.
thanks,
Pavan.
‎2006 Jul 07 4:02 PM
Loop at ITAB where FLD1 in S_FLD1.
ENDLOOP.
IF sy-subrc eq 0.
*Entry exists
ELSE.
*Entry does not exist
ENDIF.
-Kiran
‎2006 Jul 07 4:03 PM
‎2006 Jul 07 4:05 PM
HI,
loop at itab.
if itab-field in s_field.
entry exist.
else.
*entry does not exist
endif.
endloop.
Regards,
Richa
‎2006 Jul 07 4:05 PM
Hi,
do this
loop at itab where from in field.
-
logic
if it falls in the date range
endloop.
‎2006 Jul 07 4:05 PM
Hi Pavan,
Try with this code.
SELECT-OPTINS: S_MATNR FOR MARA-MATNR.
DATA ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
LOOP AT ITAB.
IF ITAB-VALUE < S_MATNR-LOW OR ITAB-VALUE > S_MATNR-HIGH.
IF SY-SUBRC = 0.
WRITE:/ 'OK'.
ELSE.
WRITE:/ 'NOT OK'.
ENDIF.
ENDIF.
ENDLOOP.
Thanks,
Vinay
‎2006 Jul 07 4:09 PM
Hi,
You can do this way..
Loop at ITAB .
if itab-from in field[].
write : 'OK'.
else.
write : 'not OK'.
endif.
endloop.regards
vijay
‎2006 Jul 07 4:12 PM
Hai Pavan
Check the following Code
tables : mara.
data : begin of itab occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
mtart like mara-mtart,
meins like mara-meins,
end of itab.
select-options : S_matnr for mara-matnr.
initialization.
clear s_matnr.
refresh : s_matnr.
s_matnr-low = '0001'.
s_matnr-high = '0010'.
s_matnr-Sign = 'I'.
s_matnr-Option = 'BT'.
append s_matnr.
start-of-selection.
select matnr
mbrsh
mtart
meins
from mara
into table itab
where matnr in s_matnr.
if sy-subrc = 0.
sort itab by matnr.
endif.
if not itab[] is initial.
loop at itab.
if itab-matnr NOT BETWEEN s_matnr-high AND s_matnr-low.
if sy-subrc = 0.
write 😕 'OK'.
else.
write 😕 'Not OK'.
endif.
endif.
endloop.
endif.
Thanks & regards
Sreenivasulu P
Message was edited by: Sreenivasulu Ponnadi
‎2006 Jul 07 4:26 PM
HI Pavan,
Loop at itab
if itab-from in field1.
write: 'XX'.
else.
write: 'YY'.
endif.
endloop.
Regards,
Laxmi.
‎2006 Jul 07 4:31 PM
Hi Pavan,
You can do it in this way. I am assuming you have some values in your Internal Table and this you want to cross check with the SELECT-OPTIONS.
Consider this code.
REPORT zarun_2.
TABLES : mara.
DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
SELECT-OPTIONS : s_mara FOR mara-matnr.
it_mara-matnr = '111111'.
it_mara-mtart = 'SAP'.
APPEND it_mara.
CLEAR it_mara.
it_mara-matnr = '222222'.
it_mara-mtart = 'SDN'.
APPEND it_mara.
LOOP AT it_mara WHERE matnr NOT BETWEEN s_mara-high AND s_mara-low.
"Some processing
ENDLOOP.
Regards,
Arun Sambargi.
‎2006 Jul 07 4:51 PM
Try this way...
Data: w_matnr type mara-matrnr,
w_werks type marc-werks.
**Selectio-Screen
Select-options s_matnr for w_matnr.
s_werks for w-werks.
**Extract Data
Select f1 f2 into <itab> from <database table>
where f3 in s_matnr
and f4 in s_werks.
**Conditional Loop.
loop at <itab> into <workarea> where f1 = s_matnr
and f2 = s_werks.
You can write your condition based on the Business Process.
"Do some processing"
Endlooop.
‎2006 Jul 07 4:57 PM
Why not do this?
loop at itab where not from in field.
... do whatever
endloop.You have to remember with select options the user has several options of entering ranges, single values, exclusions, inclusions etc. So it will not be correct to just look at LOW or HIGH or LOW and HIGH.
Unless you suppressed all other options using NO INTERVALS or NO EXTENSION or SELECTOPTIONS_RESTRICT function module, you should always use IN with a select option.