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

SELECT-OPTION to internal table

Former Member
0 Likes
18,969

Hi,

I need to convert the select-option values into an internal table.

For example, if there is a select-option S_WERKS... i need all the values entered for S_WERKS into the internal table. The internal table structure contains only WERKS.

My actual requirement is, for the given plant values as select-option, i need to fetch all details of the plants. And I should not use any SELECT statements at any stage. Only through function module/ BAPI/BADI/Class methods.

I found one function module T001W_READ, but i need to pass the plant for that.

Please suggest.

Thanks in advance.

kishore

Hi,

I need to convert the select-option values into an internal table.

For example, if there is a select-option S_WERKS... i need all the values entered for S_WERKS into the internal table. The internal table structure contains only WERKS.

My actual requirement is, for the given plant values as select-option, i need to fetch all details of the plants. And I should not use any SELECT statements at any stage. Only through function module/ BAPI/BADI/Class methods.

I found one function module T001W_READ, but i need to pass the plant for that.

Please suggest.

Thanks in advance.

kishore

5 REPLIES 5
Read only

Former Member
6,258

tables: t001w.
select-options: s_werks for t001w-werks.
types: begin of ty_werks,
         werks type t001w-werks,
       end of ty_werks.
data: wa_werks type ty_werks.
data: lt_werks type ty_werks.

loop at s_werks where option = 'EQ' and sign ='I'.
  wa_werks-werks = s_werks-low.
  append wa_werks to lt_werks
endloop.

Regards,

Subramanian V.

Read only

athavanraja
Active Contributor
0 Likes
6,258

You just need to loop at your select-option field and take the values from low and high fields.

for. e.g

loop at s_werks .

move:s_werks-low to <your itab>

if not s_werks-high is initial .

move: s_werks-high to <youritab>

endif .

append <your itab>

endloop .

Hope its clear

Regards

Raja

Read only

0 Likes
6,258

Dear Subramanian,

Thanks for your reply. But I'm concerned about in between(BT) values also... how to deat with that?

Thanks ,

Kishore

Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
6,258

Hi Kishore

Why can't you use any SELECTs? If it is so required why not writing your own FM to select them? You can pass your select-option via a generic parameter and assign it to a range at the beginning of your FM. Or you can assign it to a select-option-like table (you can find structure names of similar type from DDIC)

<i><b>e.g.</b></i>


TABLES t001w .
RANGES s_werks for t001w-werks .
DATA: BEGIN OF lt_werks ,
        werks LIKE t001w-werks ,
      END OF lt_werks .

s_werks[] = it_werks_so[] .

SELECT werks FROM t001w
       INTO lt_werks
       WHERE werks IN s_werks .
...

As another thing, let me introduce you the SDN Forums pointing system: You can assign points to posts which you find helpful while solving your problem. You can reward points by pressing the yellow star icon at header of each post. You can assign;

- one 10 points (solved)

- two 6 points (very helpful answer)

- many 2 points (helpful answer)

*--Serdar

Read only

Former Member
0 Likes
6,258

Hello Kishore,

The requirement that you cannot use any SELECT statements in your program is a little....uncommon.

So you will not be able to convert your select-options into an internal table. Not unless with some restrictions. Since the select-options allows a user to enter any combination of complex entries, you must restrict the select-options so that the user can only enter multiple single values. You can use the Function Module SELECT_OPTIONS_RESTRICT for achieving the same. this FM is very well documented.

Please let us know if this will be a suitable solution in your case.

Regards,

Anand Mandalika.