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: 

Use of FM 'SELECT_OPTIONS_RESTRICT' in other than INITIALIZATION event

VB09104
Active Participant
0 Kudos
2,189

Hi all,

I am using function module SELECT_OPTIONS_RESTRICT to restrict the select option ranges. My question is can we use this FM into another event such as AT SELECTION-SCREEN. Basically I want to restrict n grayed out Select Option High value and Ranges option on certain value of other paramter on selection screen. When I use this FM into event AT SELECTION-SCREEN it gives me exception 'TOO_LATE'.

Any idea how to use this or any other way to fullfll such requirement?

Thanks,

Vikas.

7 REPLIES 7

former_member205763
Active Contributor
0 Kudos
437

Use loop at screen and then depending on screen value disable any screen parameter u want, u can hide it, or disable input oy any option u want to perform

Former Member
0 Kudos
437

Hi Vikas,

One workaround would be to put the parameters that dictate the limits of the SELECT-OPTIONS into a pop-up screen and call this in the initialisation event. Then, still in the initialisation event use the values entered into the pop-up in the FM SELECT_OPTIONS_RESTRICT to limit the SELECT-OPTIONS.

Regards,

Nick

Former Member
0 Kudos
437

Hi,

As the documentation explains, this function module has to be used, before the screen is populated that is in the PBO event and not in the PAI.

Please go through the documentation.

Regards,

Subramanian

naimesh_patel
Active Contributor
0 Kudos
437

The FM SELECT_OPTIONS_RESTRICT would only work in INITIALIZATION event. I don't came across other FM which we can call from another event. But, you to achieve your functionality, you can have a dummy type of select option with required restricted settings and make it active when required.


DATA: w_vbeln TYPE vbak-vbeln.

TYPE-POOLS sscr.

DATA: restrict     TYPE sscr_restrict,
      opt_list     TYPE sscr_opt_list,
      associate    TYPE sscr_ass.

PARAMETERS: p_simpl RADIOBUTTON GROUP rd1 USER-COMMAND usr1 DEFAULT 'X',
            p_compl RADIOBUTTON GROUP rd1.
SELECT-OPTIONS: s_simpl FOR w_vbeln MODIF ID gp1.
SELECT-OPTIONS: s_compl FOR w_vbeln MODIF ID gp2.

INITIALIZATION.
  %_s_simpl_%_app_%-text = 'Select Option'.
  %_s_compl_%_app_%-text = 'Select Option'.

* Set the complex
  MOVE 'EQ'  TO opt_list-name.
  opt_list-options-eq = 'X'.
  APPEND opt_list TO restrict-opt_list_tab.
  associate-kind    = 'S'.
  associate-name    = 'S_COMPL'.
  associate-sg_main = 'I'.
  associate-sg_addy = ' '.
  associate-op_main = 'EQ'.
  associate-op_addy = 'EQ'.
  APPEND associate TO restrict-ass_tab.
  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      restriction = restrict.

AT SELECTION-SCREEN OUTPUT.
  CASE 'X'.
    WHEN p_simpl.
      LOOP AT SCREEN.
        IF screen-group1 = 'GP2'.
          screen-active = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    WHEN p_compl.
      LOOP AT SCREEN.
        IF screen-group1 = 'GP1'.
          screen-active = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
  ENDCASE.

Regards,

Naimesh Patel

Former Member
0 Kudos
437

Hi

Try to call it in the event AT SELECTION-SCREEN OUTPUT

Max

0 Kudos
437

Hi

U can use the event AT SELECTION-SCREEN OUTPUT instead of INITIALIZATION, just as the event is triggered before showing the selection-screen.

The problem is a new exception is eraised after calling SELECT_OPTIONS_RESTRICT again: REPEAT. It seems it can be called once, just the documentation says:

As in the report, you can only call the function module once from a logical database

Max

Former Member
0 Kudos
437

Hi

The SELECT_OPTIONS_RESTRICT only work in INITIALIZATION event. You can try using in the event AT SELECTION-SCREEN OUTPUT.

Hope this information is help to you.

Regards,

José