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: 

Reading data from Select-options

Former Member
0 Kudos

Hi,

I have a select-option on the selection screen,I want to read that data into an internal table, how should I do that ?

Please help, its urgent.

Thanks in advance.

Regards,

Dkaza

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

tables mara.

data itab like mara occurs 0 with header line.

select-options: s_matnr for mara-matnr.

start-of-selection.

select * from mara into table itab where matnr in s_matnr.

loop at itab.

write:/...

endloop.

Try this,

kc

10 REPLIES 10

Former Member
0 Kudos

Hi Deepti,

The select-option is itself an internal table.

Do u want the low value and high value of the select-option in the internal table as 2 rows??

Thank you.

0 Kudos

Hi,

I have the select option for material number.Now once the user enters the material numbers I want to read all those material numbers into a particular table and then for all these records I want to do a database fetch.

Tried to use READ Table but it doec not help the way I wanted.

Deepti

0 Kudos

Using the select options in a select statement :

SELECT-OPTIONS: SO-MFRPN FOR MARA-MFRPN.

SELECT * INTO TABLE T_MARA
  FROM MARA
  WHERE MFRPN IN SO-MFRPN.

(Remember, there is a conversion exit on MATNR, so ranges are not adequate for this field)

Regards

raymond_giuseppi
Active Contributor
0 Kudos

SELECT-OPTIONS are internal tables, so loop AT <select-option-name> to get the values you want

LOOP AT <SO>.
<SO>-SIGN : I for include, E for exclude
<SO>-OPTIONS for the test EQ, BT, etc.
<SO>-LOW for the first value
<SO>-HIGH for the high value (BT, NB)
ENDLOOP.

Regards

Former Member
0 Kudos

Hi,

  TYPES: BEGIN OF t_range,
         sign(1),
         option(2),
         low(40),
         high(40),
       END OF t_range.
  TYPES: ty_range TYPE STANDARD TABLE OF t_range.
  DATA:    wa_range   TYPE t_range,
              r_range    TYPE ty_range.

    loop at select-option.
      move-corresponding select-option to wa_range.
      append wa_range to r_range.
      clear wa_range.
    endloop.

That's all

Former Member
0 Kudos

Hi,

tables mara.

data itab like mara occurs 0 with header line.

select-options: s_matnr for mara-matnr.

start-of-selection.

select * from mara into table itab where matnr in s_matnr.

loop at itab.

write:/...

endloop.

Try this,

kc

Former Member
0 Kudos

Hi,

If you want to fetch the records for all the values in the select options, you do it directly as

Select * from database_table into i_tab

where field in select_option.

eg:

SELECT-OPTIONS:s_vstel FOR tvst-vstel.

SELECT vstel INTO TABLE i_vstel FROM tvst

WHERE vsttel IN s_vstel.

Reward if useful.

Thanks,

Muthu.

Former Member
0 Kudos

Hi Deepti,


TABLES : marc.
SELECT-OPTIONS: s_matnr FOR marc-matnr.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE marc-matnr,
END OF itab.

START-OF-SELECTION.
  SELECT matnr INTO TABLE itab FROM marc
  WHERE matnr IN s_matnr.

Message was edited by:

Perez C

Former Member
0 Kudos

Hi,

Refer following small code

Here p_orgunt is select-option field

and t_org_list is my internal table...

  • Looping through select-option field

LOOP AT p_orgunt.

  • Move org unit from select-option field into t_org_list

wa_org-objid = p_orgunt-low.

APPEND wa_org TO t_org_list.

ENDLOOP.

Former Member
0 Kudos

Thanks guys for ur help, its working good now.