06-05-2008 9:39 AM
i have put some values in the select option field material type s_mtart YTRA,YFGC and some other values and i want my selction to be restricted to only this 5 material types
and i am using this code
SELECT matnr mtart FROM mara
INTO TABLE itab_mara
FOR ALL ENTRIES IN itab_receptions
WHERE matnr = itab_receptions-matnr
AND mtart IN s_mtart.
but it is reading all the records
can u tell me why
06-05-2008 9:41 AM
Hi,
Instead of using select options, try using Ranges. You could also use an intenal table in which you collect all these values of material type and then fire the select query.
Thanks
Nayan
06-05-2008 9:42 AM
Hi,
Before writing the select querry please check whether the internal table
itab_receptions is filled.
e.g.
if itab_receptions is not initial.
SELECT matnr mtart FROM mara
INTO TABLE itab_mara
FOR ALL ENTRIES IN itab_receptions
WHERE matnr = itab_receptions-matnr
AND mtart IN s_mtart.
endif.
06-05-2008 10:05 AM
*DATA: BEGIN OF fin_guid OCCURS 10,
sign(1) VALUE 'I',
option(2) VALUE 'EQ', here u can NE
low TYPE matnr ,
high TYPE matnr,
END OF fin_guid.
pass the value in to this internal table.......
and give this table in where condition......
select....where matnr in fin_guid--> like this
this will help u...............
Reward IF.
Regards
Anbu
06-05-2008 10:22 AM
Hi ,
You need to remember two things here.
1.
If your s_mtart is not given anything on the selection screen, It can get the data for all material type.
so check like this.
2.
You have to check whether your FOR ALL ENTRIES table has data or not. Otherwise it gives dump.
IF s_mtart IS NOT INITIAL.
SELECT matnr mtart
FROM mara
INTO TABLE itab_mara
FOR ALL ENTRIES IN itab_receptions
WHERE matnr = itab_receptions-matnr
AND mtart IN s_mtart.
ENDIF.
I hope that it helps u to understand.
Regards,
Venkat.O
IF itab_receptions[] IS NOT INITIAL.
IF s_mtart IS NOT INITIAL.
SELECT matnr mtart
FROM mara
INTO TABLE itab_mara
FOR ALL ENTRIES IN itab_receptions
WHERE matnr = itab_receptions-matnr
AND mtart IN s_mtart.
ENDIF.
ENDIF.
06-05-2008 10:34 AM
While using select-options in the selection-screen you will ARROW mark click on that and enter for what are the material types you want the SELECT statement to be executed and press EXECUTE button? Then it will select that particular values only.
06-05-2008 10:52 AM
Check intiality for the internal table above before moving on to for all entries.