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: 

Restrict Select-option tab view

former_member191434
Participant
0 Kudos

Dear Guru,

I have an encountered an issue which i am fighting to resolve .

The issue is as below :

i have defined a selection screen like in my prog as below

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_field FOR dd03l-fieldname NO INTERVALS OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b2.

The above select-option is giving 4 possible option

1.Select single value(1) --> 1st Tab

2.Select ranges --> 2nd Tab

3.Exclude Single values --> 3rd tab

4.Exclude Ranges --> 4th tab

I want to keep option of 1st tab only and remaining other tab(2nd, 3rd, 4th) should be hide/disabled.

Please provide some guideline to achieve this.

Thanks & Regards

Saifur Rahaman

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

You have to use the FM: SELECT_OPTIONS_RESTRICT for this purpose. Read the documentation for details on how to use this FM.

Here is a sample code on how to achieve this.

TYPE-POOLS: SSCR.

INITIALIZATION.

* Define the object to be passed to the RESTRICTION parameter
  DATA: IT_RESTRICT TYPE SSCR_RESTRICT.

* Auxiliary objects for filling RESTRICT
  DATA: WA_OPT_LIST TYPE SSCR_OPT_LIST,
        WA_ASS      TYPE SSCR_ASS.

* JUST_EQ: Only EQ allowed
  CLEAR WA_OPT_LIST.
  MOVE 'JUST_EQ' TO WA_OPT_LIST-NAME.
  MOVE 'X' TO WA_OPT_LIST-OPTIONS-EQ.
  APPEND WA_OPT_LIST TO IT_RESTRICT-OPT_LIST_TAB.

* KIND = 'S': applies to particular SELECT-OPTION 'S_MSGTYP'
  MOVE: 'S'          TO WA_ASS-KIND,
  'S_FIELD'   TO WA_ASS-NAME, "Pass the name if the SELECT-OPTION (in CAPS)
  'I'          TO WA_ASS-SG_MAIN,
  'JUST_EQ'    TO WA_ASS-OP_MAIN,
  'JUST_EQ'    TO WA_ASS-OP_ADDY.

  APPEND WA_ASS TO IT_RESTRICT-ASS_TAB.
  CLEAR WA_ASS.

* Call the FM to restrict the SELECT-OPTIONS
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      RESTRICTION            = IT_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.

  IF SY-SUBRC <> 0.
*    No processing reqd
  ENDIF.

Hope this helps.

BR,

Suhas

3 REPLIES 3

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

You have to use the FM: SELECT_OPTIONS_RESTRICT for this purpose. Read the documentation for details on how to use this FM.

Here is a sample code on how to achieve this.

TYPE-POOLS: SSCR.

INITIALIZATION.

* Define the object to be passed to the RESTRICTION parameter
  DATA: IT_RESTRICT TYPE SSCR_RESTRICT.

* Auxiliary objects for filling RESTRICT
  DATA: WA_OPT_LIST TYPE SSCR_OPT_LIST,
        WA_ASS      TYPE SSCR_ASS.

* JUST_EQ: Only EQ allowed
  CLEAR WA_OPT_LIST.
  MOVE 'JUST_EQ' TO WA_OPT_LIST-NAME.
  MOVE 'X' TO WA_OPT_LIST-OPTIONS-EQ.
  APPEND WA_OPT_LIST TO IT_RESTRICT-OPT_LIST_TAB.

* KIND = 'S': applies to particular SELECT-OPTION 'S_MSGTYP'
  MOVE: 'S'          TO WA_ASS-KIND,
  'S_FIELD'   TO WA_ASS-NAME, "Pass the name if the SELECT-OPTION (in CAPS)
  'I'          TO WA_ASS-SG_MAIN,
  'JUST_EQ'    TO WA_ASS-OP_MAIN,
  'JUST_EQ'    TO WA_ASS-OP_ADDY.

  APPEND WA_ASS TO IT_RESTRICT-ASS_TAB.
  CLEAR WA_ASS.

* Call the FM to restrict the SELECT-OPTIONS
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      RESTRICTION            = IT_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.

  IF SY-SUBRC <> 0.
*    No processing reqd
  ENDIF.

Hope this helps.

BR,

Suhas

0 Kudos

Sir let me try this ... will inform as soon as i tried

0 Kudos

Saha da tomar code ta kaj korechhey...

Thanx a lot dada