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-optionts range as parameter

Former Member
0 Likes
710

hi experts i have a doubt, i wish to send select-options rage as

parameter to class. is there any way for this, thanks in advance

5 REPLIES 5
Read only

Former Member
0 Likes
572

Select-options is a table and Parameter is a single value ,

May be u can restrict user to enter only low value in select options

SELECT-OPTIONS : s_matnr for mara-matnr no intervals no-extension.

Read only

Former Member
0 Likes
572

i would like to sent lower and upper limits of select-options to

a method call like this

CALL METHOD OBJECT->M1 EXPORTING

Read only

Former Member
0 Likes
572

HI,

You can restrict the select-option field using No-Extension.

select-options : l_vbeln for vbeln no intervals no-extension.

See the Below program to restrict the Select-options by programetically

This report is describes how to restrict the select options. 
  
REPORT selectoptionsrestrict. 
* Include type pool SSCR 
TYPE-POOLS sscr. 
TABLES : 
  marc. 
* defining the selection-screen 
select-options : 
  s_matnr for marc-matnr, 
  s_werks for marc-werks. 
* Define the object to be passed to the RESTRICTION parameter 
DATA restrict TYPE sscr_restrict. 
* Auxiliary objects for filling RESTRICT 
DATA : optlist TYPE sscr_opt_list, 
           ass type sscr_ass. 
INITIALIZATION. 
* Restricting the MATNR selection to only EQ and 'BT'. 
  optlist-name = 'OBJECTKEY1'. 
  optlist-options-eq = 'X'. 
  optlist-options-bt = 'X'. 
  APPEND optlist TO restrict-opt_list_tab.  
  ass-kind = 'S'. 
  ass-name = 'S_MATNR'. 
  ass-sg_main = 'I'. 
  ass-sg_addy = space. 
  ass-op_main = 'OBJECTKEY1'. 
  APPEND ass TO restrict-ass_tab. 
* Restricting the WERKS selection to CP, GE, LT, NE. 
  optlist-name = 'OBJECTKEY2'. 
  optlist-options-cp = 'X'. 
  optlist-options-ge = 'X'. 
  optlist-options-lt = 'X'. 
  optlist-options-ne = 'X'. 
  APPEND optlist TO restrict-opt_list_tab. 
  ass-kind = 'S'. 
  ass-name = 'S_WERKS'. 
  ass-sg_main = 'I'. 
  ass-sg_addy = space. 
  ass-op_main = 'OBJECTKEY2'. 
  APPEND ass TO restrict-ass_tab. 
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' 
   EXPORTING 
    restriction                  = restrict 
   EXCEPTIONS 
   &nbs! p; TOO_LATE                     = 1 
     REPEATED                     = 2 
     SELOPT_WITHOUT_OPTIONS       = 3 
     SELOPT_WITHOUT_SIGNS         = 4 
     INVALID_SIGN                 = 5 
     EMPTY_OPTION_LIST            = 6 
     INVALID_KIND                 = 7 
     REPEATED_KIND_A              = 8 
     OTHERS                       = 9 
            . 
  IF sy-subrc <> 0. 
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO 
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
  ENDIF. 

Read only

athavanraja
Active Contributor
0 Likes
572

in youru class method set the importing parameter to a varialbe of type RSELOPTION (its a table type) now you can pass your range table to this parameter

Read only

Former Member
0 Likes
572

Hi,

Refer sample code:

SELECT-OPTIONS : s_legcy FOR temksv-oldkey MODIF ID rb1,

s_sap FOR temksv-newkey MODIF ID rb1.

data:i_oldkey type STANDARD TABLE OF selopt,

i_newkey type STANDARD TABLE OF selopt,

START-OF-SELECTION.

*-- Move Data Records

PERFORM move_data_records.

FORM move_data_records .

*-- Move Select Option values

IF NOT s_legcy IS INITIAL OR

NOT s_sap IS INITIAL.

MOVE s_legcy[] TO i_oldkey[].

MOVE s_sap[] TO i_newkey[].

ELSEIF NOT i_input IS INITIAL.

LOOP AT i_input INTO wa_input.

wa_selopt-sign = 'I'.

wa_selopt-option = 'EQ'.

wa_selopt1-sign = 'I'.

wa_selopt1-option = 'EQ'.

wa_selopt-low = wa_input-oldkey.

wa_selopt1-low = wa_input-newkey.

APPEND wa_selopt TO i_oldkey. " Legacy

APPEND wa_selopt1 TO i_newkey. " SAP Key

CLEAR:wa_selopt,wa_selopt1,wa_input.

ENDLOOP.

ENDIF.

ENDFORM. " move_data_records

CALL METHOD o_delete->temksv

EXPORTING

firma = p_comp

object = p_obj

CHANGING

i_oldkey = i_oldkey

i_newkey = i_newkey.

Reward points if this Helps.

Manish