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: 

Alternative Selection Options:

Former Member
0 Kudos

Hello,

I searched through the questions and did not find a question comparable to what i am looking for.

I want to have a radio button selection screen. Based on the radio button they choose,

then display further selection criteria for that button( plant, material, etc...). Seems like this event would

occur after initialization and before start-of-selection.

If there are questions just like this, please forward them link to me.

Thanks so much!!!

Steve

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

First, in order it works smoothly (without pressing ENTER after choosing one of radiobuttons) you have to assing function code to your radiobuttons.


parameters: pa_1 radiobutton group rad USER-COMMAND fcode,
                    pa_2 radiobutton group rad.

This will force triggerring PAI ( AT SELECTION-SCREEN ) every time you change your selection from pa_1 to pa_2 and vice versa.

Now you can have two different solutions:

- in PAI call different selection screens, i.e. one would have certain parameters, whereas the other would have different ones on it.


"first selection screen
SELECTION-SCREEN BEGIN OF SCREEN 110.
PARAMETERS: pa ...
....
SELECTION-SCREEN END OF SCREEN 110.
 
"second one, with different parameters
SELECTION-SCREEN BEGIN OF SCREEN 120.
parameters: pa....
SELECTION-SCREEN END OF SCREEN 120.

DATA: flag_disp TYPE c VALUE 'X'.
 
AT SELECTION-SCREEN OUTPUT.
  "first we need to call selection screen 110 - we do it only once (that's why I am using this flag and clearing it afterward)
  IF flag_disp = 'X'.
    CLEAR flag_disp.
    CALL SELECTION-SCREEN 110.
  ENDIF.
 
AT SELECTION-SCREEN.
  "now depending on radiobutton selection....
  IF pa_1= 'X'.   
    SET SCREEN 0.   "...first we leave current call sequence
    CALL SELECTION-SCREEN 110.  "then we call new selection screen
    LEAVE PROGRAM.  
  ELSE.
    SET SCREEN 0.
    CALL SELECTION-SCREEN 120.
    LEAVE PROGRAM.
  ENDIF.

The other solution (simpler one) would be placing all the fields (parameters) on selection screen and by default make them all disabled. Now depending on radiobutton selection you make them back input ready.


"first you place all the parameters you want
parameters: pa_plant ...
                    pa_matnr...

AT SELECTION-SCREEN OUTPUT.
   loop at screen.
      case screen-name.
        when 'PA_PLANT'.
           if pa_1 = 'X' . "first radiobutton selected
              screen-input = 0.  "disable PLANT
           else.
              screen-input = 1.  "enable PLANT
           endif.
        when 'PA_MATNR'.
           if pa_1 = 'X' . 
              screen-input = 1. "disable MAT
           else. 
              screen-input = 0. "enable MAT
           endif.          
      endcase.
      modify screen.
   endloop.                

Regards

Marcin

3 REPLIES 3

Former Member
0 Kudos

Hi,

You ahve to use event at selection-screen output.

There are several threads in the forum like below:

https://forums.sdn.sap.com/search.jspa?objID=c42&q=atselection-screenoutput

Regards,

Himanshu

MarcinPciak
Active Contributor
0 Kudos

First, in order it works smoothly (without pressing ENTER after choosing one of radiobuttons) you have to assing function code to your radiobuttons.


parameters: pa_1 radiobutton group rad USER-COMMAND fcode,
                    pa_2 radiobutton group rad.

This will force triggerring PAI ( AT SELECTION-SCREEN ) every time you change your selection from pa_1 to pa_2 and vice versa.

Now you can have two different solutions:

- in PAI call different selection screens, i.e. one would have certain parameters, whereas the other would have different ones on it.


"first selection screen
SELECTION-SCREEN BEGIN OF SCREEN 110.
PARAMETERS: pa ...
....
SELECTION-SCREEN END OF SCREEN 110.
 
"second one, with different parameters
SELECTION-SCREEN BEGIN OF SCREEN 120.
parameters: pa....
SELECTION-SCREEN END OF SCREEN 120.

DATA: flag_disp TYPE c VALUE 'X'.
 
AT SELECTION-SCREEN OUTPUT.
  "first we need to call selection screen 110 - we do it only once (that's why I am using this flag and clearing it afterward)
  IF flag_disp = 'X'.
    CLEAR flag_disp.
    CALL SELECTION-SCREEN 110.
  ENDIF.
 
AT SELECTION-SCREEN.
  "now depending on radiobutton selection....
  IF pa_1= 'X'.   
    SET SCREEN 0.   "...first we leave current call sequence
    CALL SELECTION-SCREEN 110.  "then we call new selection screen
    LEAVE PROGRAM.  
  ELSE.
    SET SCREEN 0.
    CALL SELECTION-SCREEN 120.
    LEAVE PROGRAM.
  ENDIF.

The other solution (simpler one) would be placing all the fields (parameters) on selection screen and by default make them all disabled. Now depending on radiobutton selection you make them back input ready.


"first you place all the parameters you want
parameters: pa_plant ...
                    pa_matnr...

AT SELECTION-SCREEN OUTPUT.
   loop at screen.
      case screen-name.
        when 'PA_PLANT'.
           if pa_1 = 'X' . "first radiobutton selected
              screen-input = 0.  "disable PLANT
           else.
              screen-input = 1.  "enable PLANT
           endif.
        when 'PA_MATNR'.
           if pa_1 = 'X' . 
              screen-input = 1. "disable MAT
           else. 
              screen-input = 0. "enable MAT
           endif.          
      endcase.
      modify screen.
   endloop.                

Regards

Marcin

Former Member
0 Kudos

Marcin,

I just did step by step what you put and it worked perfect for my scenario.

You solved my question.

Thanks a lot.

Steve