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: 

selection screen, dynamic enable and disable of blocks

Former Member

Hi,

i have several parameters in different blocks.i want to enable one block and disable other blocks depending on the radio button selection. could some one help me on this.

for eg.

radiobutton1. under this text entries for date, time etc.

radiobutton 2. under this text entries for location from, location 2,phone etc.

-


so, if i select radio button 1 all the remaining text entries under other radio buttons should be disabled. how to do this.

your help would be appreciated.

Thanks,

kranthi.

16 REPLIES 16

Former Member
0 Kudos

Hi!~~~

I think I might have that kind of problem before^^

refer some source sniffet.

PARAMETERS: ONE RADIOBUTTON GROUP R1 default 'X' 
                                  user-command rusr,
            ALL RADIOBUTTON GROUP R1,
            USER LIKE USR02-BNAME DEFAULT SY-UNAME 
                                  modif id Z1.

at selection-screen output.
  if ALL = 'X'.
    loop at screen.
	if screen-group1 = 'Z1'.
           screen-active = 0.
           modify screen.
        endif.
    endloop.
  else.
   loop at screen.
      if screen-group1 = 'Z1'.
         screen-active = 1.
         modify screen.
      endif.
   endloop.
 endif.

I wish I could you help

Regards

Kyung Woo

Former Member
0 Kudos

Hi,

Try this out,

Sample:

SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-000.

SELECT-OPTIONS: s_sapobj FOR toa01-sap_object obligatory,

s_blart FOR bkpf-blart obligatory.

PARAMETERS: rb_img RADIOBUTTON GROUP rad1 user-command rad.

PARAMETERS: rb_invo RADIOBUTTON GROUP rad1.

SELECTION-SCREEN END OF BLOCK b_1.

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

PARAMETERS: p_from like bkpf-bldat modif id gr2,

p_to like bkpf-bldat modif id gr2.

SELECT-OPTIONS: s_arobj FOR toa01-ar_object modif id gr2.

SELECTION-SCREEN END OF BLOCK b_2.

So u can validate as

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GR1'. "Name field

IF RB_INVO = SPACE.

SCREEN-ACTIVE = 0.

ELSE.

SCREEN-ACTIVE = 1.

ENDIF.

MODIFY SCREEN.

ELSEIF SCREEN-GROUP1 = 'GR2'.

IF RB_INVO = C_X.

SCREEN-ACTIVE = 0.

ELSE.

SCREEN-ACTIVE = 1.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

  • Two processing modes available based on radiobutton selection.

*Radiobutton 1 selected

IF NOT RB_IMG IS INITIAL.

PERFORM

ENDIF.

*Radiobutton 2 selected

IF NOT RB_INVO IS INITIAL.

PERFORM .

ENDIF.

Similiarly u can do.

I have given the same answer in this forum.

Thanks & Regards,

Judith.

Former Member
0 Kudos

Hi,

how to disable all the fields when a particular radiobutton is selected.

0 Kudos

Hi Kranthi,

I am not sure what you meant by disabling all the selection screen fields. Are you saying ALL the selection screen fields or all fields that don't belong to the selected radio-button.

Anyway, here is a sample code how you manipulate the selection screen. The key options to use are 'modif id', 'at selection-screen output' and 'loop at screen'.

*------------------------ Selection Screen ---------------------------*

SELECTION-SCREEN BEGIN OF BLOCK selscr WITH FRAME TITLE text-000.

PARAMETERS: p_rad1   RADIOBUTTON GROUP rad1 USER-COMMAND a DEFAULT 'X',
            p_rad2   RADIOBUTTON GROUP rad1,
            p_rad3   RADIOBUTTON GROUP rad1.

*-- Selection Screen for radio button 1
SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAME TITLE text-001.
PARAMETERS:     p_date   LIKE sy-datum DEFAULT sy-datum MODIF ID one.
SELECT-OPTIONS: s_uzeit  FOR  sy-uzeit MODIF ID one.
SELECTION-SCREEN END OF BLOCK rad1.

*-- Selection Screen for radio button 2
SELECTION-SCREEN BEGIN OF BLOCK rad2 WITH FRAME TITLE text-002.
PARAMETERS: p_werks   LIKE t001w-werks MODIF ID two.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(6) text-003 MODIF ID two.
SELECTION-SCREEN POSITION 8.
PARAMETERS: p_chk  AS CHECKBOX DEFAULT 'X' MODIF ID two.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK rad2.

*-- Selection Screen for radio button 3
SELECTION-SCREEN BEGIN OF BLOCK rad3 WITH FRAME TITLE text-004.
PARAMETERS: p_matnr   LIKE mkal-matnr MODIF ID tri,
            p_verid LIKE mkal-verid MODIF ID tri.
SELECTION-SCREEN END OF BLOCK rad3.

SELECTION-SCREEN END OF BLOCK selscr.

*--------------------------
AT SELECTION-SCREEN OUTPUT.
*--------------------------

  IF p_rad1 = 'X'.
    LOOP AT SCREEN.
      IF  screen-group1 = 'TWO' OR
          screen-group1 = 'TRI'.
        screen-input = 0.
        screen-invisible = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF p_rad2 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'ONE' OR
         screen-group1 = 'TRI'.
        screen-input = 0.
        screen-invisible = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF p_rad3 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'ONE' OR
         screen-group1 = 'TWO'.
        screen-input = 0.
        screen-invisible = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

If you want to hide all the, I mean all except the radio-buttons, then simply loop at screen and modify every entry except the radio-button entries to screen-active 0. Something like this.


LOOP AT SCREEN.
  IF SCREEN-NAME = 'RAD1' OR
     SCREEN-NAME = 'RAD2 OR
     SCREEN-NAME = 'RAD3'.
  ELSE.
    SCREEN-ACTIVE = 0.
    MODIFY SCREEN.
  ENDIF.
ENDLOOP.

Srinivas

Former Member
0 Kudos

Hi,

Thanks very much. it works well .

however there is one more problem, when i execute the program all the input fields are enabled for the first time until i select a radio button.

how to display only those fields related to a particular radio button selection(its selecting first radio button by default) which i defaulted to or the first radio button in the series.

0 Kudos

set the default to 'X'.

parameters p_param radiobutton group grp default 'X'.

Rishi

Former Member
0 Kudos

Hi,

i did that but still all the input fields are enabled when i run the program and to disable or enable the fields based on radio button selection i have to select the option only after that the logic gets executed normally.

Is there any way out to see the fields enabled and disabled when the selection screen is displayed and even before we select the option, atleast a hard coded way...

kranthi.

0 Kudos

Hi Kranthi,

Where did you put the code that modifies the screen based on the radio button selection? It should be in the <b>AT SELECTION-SCREEN OUTPUT</b> event. This event will always be triggered whenever the selection screen needs to be displayed, even the very first time. If it is still not working, then please post the selection screen definition and the logic where you modify the screen.

If it works, please close the post.

Srinivas

Former Member
0 Kudos

Thank you all. my problem has been addressed.i'm able to run the program successfully.

Thanks once again.

kranthi.

Former Member
0 Kudos

one more piece of information,

as i'm new to this forum, could some one tell me how to give points.

Thanks,

kranthi.

0 Kudos

Hi Kranthi,

Rfer to , where I have answered your question.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi Kranthi,

First, you need to mark this post as a question and then follow Anand's instructions for rewarding the points.

Srinivas

Former Member
0 Kudos

Hi!

The solution given by <b>Srinivas Adavi</b> and <b>Kyung Woo, Nam</b> works well but only after double-click on a radio button.

Could anyone help and tell me what I should do in order to make it work after single-click?

Thanks,

Tomek

0 Kudos

refer to: the link above

Former Member
0 Kudos

Hello,

Event ''at selection screen output'' does not triggered when some radio button is selected. Any idea .

Thanks

0 Kudos

Hello,

Add following to your radio button.

user-command a default 'X'.

Best Regards

Swanand