cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling a block on selection screen

Former Member
0 Kudos

Hi Guys,

Can somebody please give me a code if for example, I have 2 blocks in my selection screen and I have two radiobuttons to choose from. Each radiobutton corresponds to a particular block on the screen. If I choose the 1st radiobutton, I want the whole of second block disabled and vice-versa.

I would really appreciate your help.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

You have to use the event 'at selection-screen output' and LOOP AT SCREEN to disable the block.

An example program can be found at.

Cheers

Vinod

Message was edited by: Vinod C

Answers (4)

Answers (4)

Former Member
0 Kudos

SELECTION-SCREEN BEGIN OF BLOCK B1.

SELECT-OPTIONS:

s1 for vabk-vbeln modif id ORD,

s2 for vbak-vkorg modif id ORD,

s3 for vbap-posnr modif id ITM,

s4 for vbap-posnr modif id ITM.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ORD'.

SCREEN-INPUT = '0'.

refresh S1.

refresh S2.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

Hi!

Thanks to everyone who provided their inputs. It was such a quick answer and all your inputs helped solved my problem.

Best regards.

Former Member
0 Kudos

Hi,

Check this link,

<u>http://help.sap.com/saphelp_erp2004/helpdata/en/79/34a23dd9b511d1950e0000e8353423/frameset.htm</u>

Hope it helps u.

Kindly reward points if u find it useful.

Thanks&Regards,

Ruthra

Former Member
0 Kudos

In the event AT SELECTION SCREEN OUTPUT you can do

a LOOP AT SCREEN and turn off the ACTIVE

indicator.

Use the debugger to determine what the name of the

field is that you want to hide.

So something like

*Code used to Initiate the 'AT selection-screen'

EVENT from radiobuttons.

selection-screen begin of block group with frame 
title text-s04.
parameters: p_sel1 type c radiobutton group sel 
<b>user-command upd.</b>
parameters: p_sel2 type c radiobutton group sel.
selection-screen end of block group.


LOOP AT SCREEN.  
IF SCREEN-FIELDNAME = 'the name'. 
   SCREEN-ACTIVE = '0'.  
  MODIFY SCREEN.
ENDLOOP.

Check this sample code with three radio buttons.


SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-h01.
*Radio button for Process PO invoice
PARAMETERS :   rb_po   RADIOBUTTON GROUP inv USER-COMMAND rad.
*Radio button for FI Invoice
PARAMETERS :   rb_fi   RADIOBUTTON GROUP inv.
*Radio button for Process PO & FI Invoice
PARAMETERS :     rb_pofi   RADIOBUTTON GROUP inv.

SELECTION-SCREEN END OF BLOCK b3.

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

SELECT-OPTIONS: s_bukrs FOR rbkp-bukrs,   "Company Code
                s_ekorg FOR ekko-ekorg NO INTERVALS MODIF ID md2,   "Purchasing Org.
	s_ekgrp FOR ekko-ekgrp NO INTERVALS MODIF ID md2,
                                        "Purchasing Group
      s_werks FOR rseg-werks NO INTERVALS MODIF ID md2,
	        "Plant
      s_lifnr FOR rbkp-lifnr NO INTERVALS,           "Vendor
      s_matkl FOR ekpo-matkl NO INTERVALS                 MODIF ID md1,   "Material Group
      s_belnr FOR rbkp-belnr NO INTERVALS,
                                    "Invoice Number
      s_ebeln FOR rseg-ebeln NO INTERVALS MODIF ID md2,
                              "Purchasing Document No
      s_gjahr FOR rbkp-gjahr NO INTERVALS,
                                  "Fiscal year
      s_budat FOR  rbkp-budat NO INTERVALS,
                                      "Posting date
      s_blart   FOR  bkpf-blart NO INTERVALS,
                                " Document Type
      s_bldat   FOR  bkpf-bldat NO INTERVALS,
                                 " Invoice Date      s_usnam   FOR  rbkp-usnam NO INTERVALS.
"User
****************************************************************
*Report type
****************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE.
*Radio button for User Report
PARAMETERS :     rb_user  RADIOBUTTON GROUP za DEFAULT 'X' <b>USER-COMMAND rad MODIF ID md2.</b>
"User report
SELECTION-SCREEN COMMENT 3(20) text-003 FOR FIELD rb_user <b>MODIF ID md2.</b>
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
*Radio button for Managing Report
PARAMETERS :     rb_man   RADIOBUTTON GROUP za
                                     <b> MODIF ID md2.</b>
"Management Report
SELECTION-SCREEN COMMENT 3(20) text-004 FOR FIELD rb_man
                                       <b> MODIF ID md2.</b>
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END  OF BLOCK b2.

SELECTION-SCREEN END  OF BLOCK b1.


<b>AT SELECTION-SCREEN OUTPUT.</b>

* Checking Radiobuttons and modifing Material Group field  .
  PERFORM f13000_check_radio.


FORM f13000_check_radio.
* When the FI button is selected hide the fields under group md1 and MD2
  LOOP AT SCREEN.
<b>    IF screen-group1 = 'MD2'
    OR screen-group1 = 'MD1'.</b>
      IF rb_fi  = c_x
      OR rb_pofi = c_x.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

* If the user output radiobutton is checked then make the screen
* input of Material Group off
  LOOP AT SCREEN.
<b>    IF screen-group1 = 'MD1'.</b>
      IF rb_user = 'X'.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

  IF <b>rb_user = 'X'.</b>
*   When display for material group is off
*   then refresh the select option for material
*   group
    REFRESH s_matkl.
  ENDIF.
ENDFORM.      " f13000_check_radio

Message was edited by: Judith Jessie Selvi

Former Member
0 Kudos

u can disable the block

loop on screen and check for the screen-name equals to block and do screen-input = 0.

all the best