11-20-2007 2:50 PM
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
11-20-2007 2:53 PM
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
11-20-2007 2:53 PM
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
11-20-2007 2:55 PM
Naimesh,
will this work even if I provide the high value of select-options as null?
thanks
11-20-2007 3:04 PM
11-20-2007 3:10 PM
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
11-20-2007 3:38 PM
> 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.
11-20-2007 2:55 PM
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.
11-20-2007 3:38 PM
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.