Skip to Content
0
Former Member
Feb 25, 2014 at 08:36 AM

How to use Check Box Control other field's visibility/activation.

804 Views

On my report filter screen, I want to use a check box to control other field's visibility/ activation. That is to say when user check it, he want to show one filter item and hide another and vice versa.

I use the following code but this does not work. The check box's default value is space. When I check the checkbox, no change happens.

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

SELECT-OPTIONS:

s_kunnr FOR ZSALESDISTIMP-distno,

s_year FOR ZSALESDISTIMP-syear MODIF ID NST,

s_month FOR ZSALESDISTIMP-smonth MODIF ID NST,

s_matno FOR ZSALESDISTSTOCK-matno MODIF ID STK,

s_date FOR ZSALESDISTSTOCK-stockdate MODIF ID STK.

PARAMETERS: p_stock AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

case screen-group1.

WHEN 'STK'.

if p_stock <> 'X'.

screen-input = '0'.

screen-invisible = '1'.

screen-output = '0'.

ELSE.

screen-input = '1'.

screen-invisible = '0'.

screen-output = '1'.

ENDIF.

MODIFY SCREEN.

WHEN 'NST'.

if p_stock = 'X'.

screen-input = '0'.

screen-invisible = '1'.

screen-output = '0'.

ELSE.

screen-input = '1'.

screen-invisible = '0'.

screen-output = '1'.

ENDIF.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.