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: 

passing select-options table to a class method

Former Member
0 Kudos

Hi,

I have to pass a table which contains a select-options to a class method as a param...

How I do this??

...

DATA s_mail TYPE z_mail_rng.

:::

o_mail->add_receiver( ? ).

(add_receiver's formal param is TYPE ANY)

Plese give me help.

Thanks.

4 REPLIES 4

Former Member
0 Kudos

Hi,

I usually create a stucture in SE11 that represents the RANGE fields (SIGN, OPTION, LOW, HIGH) and a table type with line type of this newly created structure.

This table type has to be assigned to the appropriate parameter in method signature. Then you can call the method with the SELECT-OPTIONS

o_mail->add_receiver( it_sel = so_range[] ).

You can create a range table type by using the function Edit -> Define as ranges table type. With this function the range structure will be created automatically with the data element you entered.

Regards Rudi

Former Member
0 Kudos

Hi,

I send coding for how to use select-options in class.

May it is useful for u

tables:marc.

selection-screen begin of block b1 with frame title text-001.

select-options: s_matnr for marc-matnr.

selection-screen end of block b1.

class c3 definition.

public section.

types: begin of ty_marc,

matnr type marc-matnr,

werks type marc-werks,

end of ty_marc.

data: wa_itab type ty_marc.

data: itab type table of ty_marc .

data: wa_matnr type r_matnr.

methods: add.

private section.

*methods: sub.

endclass.

class c3 implementation.

method add .

select matnr

werks

from marc into table itab where matnr IN s_matnr.

write:/ 'material no', 20 'plant'.

loop at itab into wa_itab.

write:/ wa_itab-matnr,

wa_itab-werks.

endloop.

endmethod .

endclass.

start-of-selection.

data b1 type ref to c3.

create object b1 .

call method b1->add.

Former Member
0 Kudos

Hi

U can define a param TYPE TABLE instaed of TYPE ANY.

In this way u can transfer any type of internal table, so a range or select-options too.

Max

0 Kudos

You can also use the type RSELOPTION

as in :

APPT_TYPE_RANGE                TYPE        RSELOPTION

hth,

Nigel