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 sel FOR Internal Table

Former Member
0 Kudos

Hello,

I would like to use select-options. Normally you can specify a selection tab (sel) and a row of an table being registered in the ABAP dictionary.

I would like to use an internal table instead.

First I read data into the internal table. Next I would refer on one column of that internal using the select-options:

SELECT * FROM database-tab INTO itab

WHERE key1 = 'a'.

SELECT-OPTIONS: sel FOR itab.

It does not work, although the internal table is filled!!!

Can I use internal tables with select-options?

thx, holger

9 REPLIES 9

Former Member
0 Kudos

Dear,

You can only use elementary types with select-options.

Since your internal table is not elementary type so you can't use internal tables.

Rg,

VM

abdul_hakim
Active Contributor
0 Kudos

Hi you can only use elementary type with ur select options

for eg

SELECT-OPTIONS s1 FOR itab-kunnr.

REgards,

Abdul

0 Kudos

is there any other possibility to use only specified entries of a database table for the select-options?

i wanted to use an internal table, where i read in specified entries and use that table for the select-options, but this is not possible...

any suggesntions?

thx, holger

0 Kudos

Hallo Holger,

i think i get it now - thanks Amit !

here's an example:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR matnr-low.
  SELECT matnr maktg FROM m_mat1t
  INTO CORRESPONDING FIELDS OF TABLE f4_itab
  WHERE mtart = 'DIEN'.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            retfield     = 'MATNR'
            dynpprog     = sy-repid
            dynpnr       = sy-dynnr
            dynprofield  = 'MATNR'
            window_title = 'select material no.'
            value_org    = 'S'
       TABLES
            value_tab    = f4_itab[].

Andreas

0 Kudos

Hi Andreas,

Your example is very good i got my output.

my requirement was,  in output screen if u press select option field then only selected fields suppose to come for display. i created internal table did select query for that and displayed my selected field in select option F4 help.

Thanks a lot.

Ankit Rai

former_member188685
Active Contributor
0 Kudos

Hi Internal Table You Cannot Use ,

But if you have any type of that ITAB existing in sap then I think you can use .

regards

vijay

Former Member
0 Kudos

Hi holger,

1. i could not make out ur exact requirement.

2. from ur last post, what i understood partially

(may be im wrong)

that u want to use a select-option on your screen.

when user wants to select some value

u want to show your internal table (and not the default input field)

3. we can use FM

F4IF_FIELD_VALUE_REQUEST

just see the documentation.

Hope it helps.

regards,

amit m.

mathias_lange3
Explorer
0 Kudos

Hi Holger,

if you want the results of your db-select (e.g. you get 5 kunnr and want this 5 entries in your field) in the select-options field, try this:

DATA: z_kunnr TYPE dbtab-kunnr.

SELECT-OPTIONS so_kunnr FOR z_kunnr.

INITIALIZATION.

SELECT * FROM database-tab INTO itab

WHERE key1 = 'a'.

loop at itab into wa.

so_kunnr-sign = 'I'.

so_kunnr-option = 'EQ'.

so_kunnr-low = wa-kunnr.

APPEND so_kunnr.

endloop.

Now you have for every selected row from the db an entry in the itab so_kunnr. If you want to select datas from a db, you can use:

select * from db into table itab where key in so_kunnr.

0 Kudos

Can you please explain your requirement with an example?

Srinivas