Application Development and Automation 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: 
Read only

dynamic select option

Former Member
0 Likes
522

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

4 REPLIES 4
Read only

Former Member
0 Likes
501

Hi,

Try this.

SELECT * FROM spfli

INTO CORRESPONDING FIELDS OF TABLE <fs_itab>

where col1 in o_rows.

Regards,

Niyaz

Read only

0 Likes
501

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

Read only

0 Likes
501

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

Read only

former_member194669
Active Contributor
0 Likes
501

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®