Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

select options

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

*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

venkat_o
Active Contributor
0 Kudos

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.

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.
2. You have to check whether your FOR ALL ENTRIES table has data or not. Otherwise it gives dump.

  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.
I hope that it helps u to understand. Regards, Venkat.O

Former Member
0 Kudos

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.

Former Member
0 Kudos

Check intiality for the internal table above before moving on to for all entries.