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

Hi All,

I have used a select-options in my program. I want to fill an internal table with all teh corresponding values that qualify from the select-options.

lets say I have a select-options for field id, then I want an internal table for all ids that are provided as input in select options

for eg id1 to id4 then I want an itab with values id1 id2 id3 and id4

thanks,

HM

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

You need to select the data from the master table of the ID.

Like for MATNR we can do like this:


select matnr
from mara    " << your master reocrd for ID
into table it_mara     " << your internal table
whre matnr in s_matnr . " << your select option

Regards,

Naimesh Patel

7 REPLIES 7

naimesh_patel
Active Contributor
0 Kudos

You need to select the data from the master table of the ID.

Like for MATNR we can do like this:


select matnr
from mara    " << your master reocrd for ID
into table it_mara     " << your internal table
whre matnr in s_matnr . " << your select option

Regards,

Naimesh Patel

0 Kudos

Naimesh,

will this work even if I provide the high value of select-options as null?

thanks

0 Kudos

then it fills only one value in itab.

0 Kudos

You must use entrie Select-options.. without specifing low or high. Because you can put mulitple values on the selection screen in the Select options.

If you have a problem in finding out the master table, please let us know.

Regards,

Naimesh Patel

0 Kudos

> Naimesh,

> will this work even if I provide the high value of

> select-options as null?

By null you mean empty? If you only type in the low value, by default it will be interpreted as an exact equals (I EQ). If you try to force it to be a range (I BT) you will get an error because low would be greater than high.

If you're manipulating them diectly you may get odd results, so be careful.

Former Member
0 Kudos

Hi

very simple,


TABLES : marc.
DATA : BEGIN OF itab OCCURS 0,
werks LIKE marc-werks,
END OF itab.
SELECT-OPTIONS: werks FOR marc-werks.

SELECT werks INTO CORRESPONDING FIELDS OF TABLE itab FROM 
marc WHERE werks IN s_werks.

Former Member
0 Kudos

Hi,

You can use the below code to fill the values of select options into an internal table.

tables : bsis.

data : count type i.

data : begin of itab occurs 0,
            buzei like bsis-buzei,
         end of itab.

select-OPTIONS : num for bsis-buzei.


start-of-SELECTION.
count = 1.
do num-high times.

if count = 1.
  count = num-low.
  move : count to itab-buzei.
  append itab.
  clear itab.
  count = count + 1.
else.
  move : count to itab-buzei.
  append itab.
  clear itab.
  count = count + 1.
endif.

if count GT num-high.
 exit.
endif.

enddo.

Thanks,

Sriram Ponna.