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: 

Urgent:SELECT_OPTIONS_RESTRICT function module

Former Member
0 Kudos

I have to use declare the PO number,IDoc Number,Invoice number in the selection screen and the criteria is it must be Multiple single values and Optional so i can use this FM.How should i declare?

6 REPLIES 6

Former Member
0 Kudos

HI,

try like this.


tables:mara.
SELECT-OPTIONS mat for mara-matnr no INTERVALS.

rgds,

bharat.

0 Kudos

sorry i have to make use of this FM in my scenario for all the three.How should i do?

Former Member
0 Kudos

Hema,

***SELECTION-SCREEN----


SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_bukrs LIKE zap_clearing_hst-planning_plant OBLIGATORY

DEFAULT '1000',

p_spart LIKE knvv-spart OBLIGATORY DEFAULT '02'.

SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECT-OPTIONS: s_kund1 FOR zvdevice_history-kund1

MATCHCODE OBJECT zkunnr_ccn2006 NO INTERVALS,

s_bzirk FOR zvdevice_history-bzirk NO INTERVALS.

SELECT-OPTIONS: p_equnr FOR zvdevice_history-equnr.

SELECTION-SCREEN: END OF BLOCK b2.

SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETERS: p_delim TYPE c DEFAULT c_comma OBLIGATORY,

p_path LIKE rlgrap-filename

DEFAULT '/data/sapdata/PORTFOLIO/' OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK b3.

INITIALIZATION.

PERFORM restrict_input_parameter.

  • 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.

  • Restricting the MATNR selection to only EQ.

optlist-name = 'OBJECTKEY1'.

optlist-options-eq = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_KUND1'.

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-eq = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_BZIRK'.

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.

Don't forget to reward if useful...

0 Kudos

The PO number,Idoc number and invoice number should be declared as Multiple single values and Optional and other declarations also there but am not clear in the first part alone

0 Kudos

Hi,

Refer this pgm.

REPORT  ZAK_SEL_OPT_RESTRICT                    .

tables: mara.

* Type pools
type-pools: slis, sscr.

* Selection Screen
select-options: s_date for sy-datum no intervals,
                s_no   for mara-matnr.

initialization.
   data: restrict type sscr_restrict,
         selopt   type sscr_ass,
         opt_list type sscr_opt_list. "BT,CP,EQ,GE,GT,LE,LT,NB,NE,NP


  clear selopt.
  selopt-kind            = 'S'.      " S-SELCT-OPTIONS, A-ALL, B-BLOCK
  selopt-name            = 'S_DATE'. " NAME OF THE SELECT-OPTIONS
  selopt-sg_main         = 'I'.      " I-INCLUSIVE, SPACE-BOTH
  selopt-op_main         = 'OBJ_1'.
  append selopt  to restrict-ass_tab.

  clear opt_list.
  opt_list-name          = 'OBJ_1'.
  opt_list-options-eq    = 'X'.
  opt_list-options-ge    = 'X'.
  append opt_list to restrict-opt_list_tab.


  clear selopt.
  selopt-kind            = 'S'.
  selopt-name            = 'S_NO'.
  selopt-sg_main         = 'I'.
  selopt-op_main         = 'OBJ_2'.
  append selopt  to restrict-ass_tab.


  clear opt_list.
  opt_list-name          = 'OBJ_2'.
  opt_list-options-ne    = 'X'.
  opt_list-options-bt    = 'X'.
  opt_list-options-le    = 'X'.
  append opt_list to restrict-opt_list_tab.

  call function 'SELECT_OPTIONS_RESTRICT'
       exporting
            restriction            = restrict
       exceptions
            too_late               = 1
            repeated               = 2
            selopt_without_options = 5
            selopt_without_signs   = 6
            invalid_sign           = 7
            empty_option_list      = 9
            invalid_kind           = 10
            repeated_kind_a        = 11
            others                 = 12.

0 Kudos

Hi,

Try this

TYPE-POOLS sscr.

Tables: KOMG.

Select-Options:

s_prod for komg-matnr.

DATA restrict TYPE sscr_restrict.

DATA : optlist TYPE sscr_opt_list,

ass type sscr_ass.

write this code in INITIALIZATION

optlist-name = 'OBJECTKEY1'.

optlist-options-bt = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_PROD'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY1'.

APPEND ass TO restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

EXCEPTIONS

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