‎2007 Oct 04 4:00 PM
Hello, Could some one please help to show how to accomplish my select using a seletion-option field rather then
UP TO 100 ROWS in my select statement.
This is how my code looks like:
SELECT-OPTIONS:o_rows FOR tab-col OBLIGATORY DEFAULT '1' TO '100' NO-EXTENSION.
SELECT * FROM spfli
INTO CORRESPONDING FIELDS OF TABLE <fs_itab>
UP TO 100 ROWS.
I want the users should be able to give the number of rows to be selected using a SELECT-OPTIONS: o_rows rather then coding the number of rows in the code as I have done.
Thank every body for his or her input.
Nadin
‎2007 Oct 04 4:18 PM
Hi,
Try this.
SELECT * FROM spfli
INTO CORRESPONDING FIELDS OF TABLE <fs_itab>
where col1 in o_rows.
Regards,
Niyaz
‎2007 Oct 04 4:29 PM
hi Niyaz, thank you for your input. But it didn't work.
First I had the following:
CLEAR o_row.
FREE o_row.
o_row-sign = 'I'.
o_row-option = 'EQ'.
SELECT * FROM spfli
INTO CORRESPONDING FIELDS OF TABLE <fs_itab>
where col1 in o_rows.Is col1 the row column?
I had to initialize o_row bc it is an internal table with header line.
Message was edited by:
nadin ram
‎2007 Oct 04 11:19 PM
Hello,
I still have a trouble solving this problem.
report ztest.
field-symbols:
<fs_itab> type table of any.
<fs_wtab> type any.
start-of-selection.
SELECT * FROM spfli
INTO CORRESPONDING FIELDS OF TABLE <fs_itab>
UP TO 10 ROWS.
loop at <fs_itab> assigning <fs_wtab>
write: / ....
endloop.I have hard coded the UP TO 10 ROWS. But now I want the user to decide how many rows of date he wants to output.I therefore created a SELECT-OPTIONS.
This is how my code now looks like.
report ztest.
SELECT-OPTIONS: o_rows FOR tab-col OBLIGATORY DEFAULT '1' TO '100' NO-EXTENSION.
AT SELECTION-SCREEN.
o_rows-sign = 'I'.
o_rows-option = 'BT'.
o_rows-low = 1.
if o_rows-high is initial
o_rows-high = o_rows-low.
append o_rows.
start-of-selection.
select * spfli
into corresponding fields of table <fs_itab>
up to o_rows rows.
But it is still not working. Does some one have an idea how to solve this?
Thank you
Nadin
‎2007 Oct 04 4:24 PM
Hi,
May be this way
parameters : p_rows like rseumod-tbmaxsel default 100.
start-of-selection.
select *
into corresponding fields of table i_mara
up to p_rows rows
from mara.
a®