Skip to Content
author's profile photo Former Member
Former Member

Passing select-options value in method

How to pass select-options value in method ?


Select-options: carrid for spfli-carrid.

class cl_myclass implementation.

select carrid connid from

spfli where carrid in carrid.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jan 26, 2008 at 12:54 PM

    Hello Anee

    The easiest (and probably most elegant) way is to use function module RS_REFRESH_FROM_SELECTOPTIONS.

    In the CONSTRUCTOR method of your class you add an EXPORTING parameter IM_CALLING_PROGRAM.

    Within the CONSTRUCTOR method you call the function module with the value of the calling program (which is your selection report). The function module returns you all current selection criteria of the report.

    Have a look at class CL_DBSEL_CATS for a SAP standard example.



    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Anee

      The coding of this functionality is quite simple:

      REPORT zmy_report.
      DATA:  go_myclass   TYPE REF TO zcl_myclass,
                 gd_repid         TYPE syst-repid.
        p_bukrs   ...
        o_kunnr  ...
        gd_repid = syst-repid.
        CREATE OBJECT go_myclass
            id_calling_program = gd_repid.

      And that's how your CONSTRUCTOR method should look like:

      METHOD constructor.  " IMPORTING parameter id_calling_program
          CURR_REPORT = id_calling_report
          SELECTION_TABLE = me->mt_selopts.
      " NOTE: define mt_selopts as instance attribute of table type RSPARAMS_TT

      Finally you have to extract the parameter and select-options from MT_SELOPTS.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.