Skip to Content
0
Former Member
Jun 13, 2016 at 03:25 PM

Button with icon_collapse doesn't hide fields

37 Views

Dear experts,

I have created a button (with icon_expand/icon_collapse as label) in order to expand/collapse some fields in the block of a selection screen.

The problem is, the fields are not collapsed back, although they expand properly. screen-invisible is set to 1...

The coding is the following:

SELECTION-SCREEN BEGIN OF BLOCK additional_fields WITH FRAME TITLE text-111.

SELECTION-SCREEN: "Button for additional fields

BEGIN OF LINE,

PUSHBUTTON 1(4) add_fld USER-COMMAND addfld MODIF ID nn1,

COMMENT 8(70) text-fld MODIF ID nn1,

END OF LINE.

PARAMETERS: p_addfld NO-DISPLAY.

SELECT-OPTIONS: s_matnr FOR gs_mara-matnr MODIF ID mat,

s_werks FOR gs_marc-werks MODIF ID mat.

SELECTION-SCREEN END OF BLOCK additional_fields.


......


INITIALIZATION.

title = text-101 .

p_addfld = ''.

IF add_fld IS INITIAL.

add_fld = icon_expand.

ENDIF.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'MAT'.

screen-input = 0.

screen-active = 0.

screen-invisible = 1.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

.....

AT SELECTION-SCREEN ON BLOCK additional_fields.

IF sy-ucomm = 'ADDFLD'.

IF p_addfld = 'X'.

p_addfld = ''.

add_fld = icon_expand.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'MAT'.

screen-input = 0.

screen-active = 0.

screen-invisible = 1.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ELSE.

p_addfld = 'X'.

add_fld = icon_collapse.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'MAT'.

screen-input = 1.

screen-active = 1.

screen-invisible = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDIF.

ENDIF.


Please advise me how to proceed.

Thank you!


BR,

Matei