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
167

How to move data from select options into an internal table.

For example

At selection screen my filed is s_subtype.

user gives a range of subtypes.

I want to move these into aN INTERNAL TABLE.

How is this possible

Please provide pointers.

TIA

10 REPLIES 10

Former Member
0 Kudos
118

Hi,

The value provided in the select options will be stored as an internal table.

You can use the same name which provided for the Select options.

so, s_subtype will hold all the records.

Thanks,

Mohanraj.N

kesavadas_thekkillath
Active Contributor
0 Kudos
118

loop at s_subtype.

move s_subtype-low to it-val.

append it.

endloop.

rainer_hbenthal
Active Contributor
0 Kudos
118

s_subtype is an internal table.

Former Member
0 Kudos
118

Define a internal table t_dum.

pass values like

t_dum-low = s_subtype-low.

t_dum-high = s_subtype-high.

append t_dum.

Former Member
0 Kudos
118

Hi,

The select option itself act as internal table. It has following fields: Sign,Option,High value and low value.

Just loop the select option variable and read the data and transfer data to internal table.

LOOP AT s_option.

if s_option-option EQ 'EQ'

itab-value = s_option-low.

append itab.

else.

itab-value = s_option-low.

append itab.

itab-value = s_option-high.

append itab.

endif.

ENDLOOP.

In this way it can be done.

Regards,

Brajvir

former_member188829
Active Contributor
0 Kudos
118

Hi,

Check this example.

You can not directly get the all values from select-options. In select-options, you will get low and high values only. if you want to get between these high and low values you have to write select query and get that values into the internal table.

Example:

TABLES:mara.

DATA:BEGIN OF it_matnr OCCURS 0,
     matnr LIKE mara-matnr,
     END OF it_matnr.

SELECT-OPTIONS:s_matnr FOR mara-matnr.

START-OF-SELECTION.

  SELECT matnr FROM mara INTO TABLE it_matnr WHERE matnr IN s_matnr.

  LOOP AT it_matnr.
    WRITE: it_matnr-matnr.
  ENDLOOP.

Former Member
0 Kudos
118

Hi,

You can directly pass the value into internal table. For eg.

Suppose you have a selection field sub-low and your internal table is itab.

itab-low = sub-low .

now you can modify the itab or append.

Like

Modify itab transporting low.

or

append itab.

Hope this will solve your problem.

Former Member
0 Kudos
118

If I have understood your question right,

try to query the database using the 'IN' parameter.

for eg

SELECT VKORG FROM VBAK INTO TABLE T_VBELN WHERE VBELN IN S_ORG.

Or, if you want to move your select options range of values into your internal table then declare an internal table like

data: begin of itab,

low type string,

high type string,

end of itab.

select-options: s_org for vabk-vbeln.

itab-low = s_org-low.

itab-high = s_org-high.

append itab.

The select options has for fields - sign, option, high, low.

Edited by: Nitwick on Jun 3, 2009 2:49 PM

Former Member
0 Kudos
118

Hi,

Use event At Selection screen output.

and append this ranges and use in your internal table.

Regards,

Vijay

Former Member
0 Kudos
118

Hi,

do it like below:

TABLES :mara.

SELECT-OPTIONS : s_matnr FOR mara-matnr.

DATA : BEGIN OF itab OCCURS 0,

matnr TYPE matnr,

END OF itab.

DATA : gv_matnr_high TYPE matnr.

LOOP AT s_matnr.

itab-matnr = s_matnr-low.

APPEND itab.

IF NOT s_matnr-high IS INITIAL.

gv_matnr_high = s_matnr-low.

DO.

IF s_matnr-high GT s_matnr-low.

gv_matnr_high = gv_matnr_high + 1.

CONDENSE gv_matnr_high NO-GAPS.

itab-matnr = gv_matnr_high.

APPEND itab.

ENDIF.

IF gv_matnr_high = s_matnr-high.

EXIT.

ENDIF.

ENDDO.

ENDIF.

ENDLOOP.

Hope it helps!!

Rgds,

Pavan