El siguiente ejemplo muestra como crear un bloque dentro de otro de pantalla de selección y a su vez sea visible o no dependiendo del radio button escogido. Al igual que se hizo para generar este ejemplo se recomienda tener un pgm ZPRUEBA como obj. local para futuros ejemplos.
(link descarga código, igual esta abajo)
modelo pantalla selección
textos parámetros y radio buttons
código
*&---------------------------------------------------------------------*
*& Report ZPRUEBA*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zprueba.
TABLES: bsid,
vbrk.
"BLOQUE PRINCIPAL
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS:
r_a RADIOBUTTON GROUP r1 USER-COMMAND rbut DEFAULT 'X',
r_b RADIOBUTTON GROUP r1.
"BLOQUE A
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS:
r_a1 RADIOBUTTON GROUP r2 USER-COMMAND rbut DEFAULT 'X' MODIF ID zz1,
r_a2 RADIOBUTTON GROUP r2 MODIF ID zz1.
"BLOQUE A.1
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-t04.
PARAMETERS:p_a10 TYPE bsid-bukrs MODIF ID za1,
p_a11 TYPE bsid-bukrs MODIF ID za1,
p_a12 TYPE bsid-bukrs MODIF ID za1.
SELECTION-SCREEN END OF BLOCK b4.
"BLOQUE A.2
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-t05.
PARAMETERS:p_a20 TYPE bsid-bukrs MODIF ID za2,
p_a21 TYPE bsid-bukrs MODIF ID za2.
SELECTION-SCREEN END OF BLOCK b5.
SELECTION-SCREEN END OF BLOCK b2.
"BLOQUE B
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS:
r_b1 RADIOBUTTON GROUP r3 USER-COMMAND rbut DEFAULT 'X' MODIF ID zz2,
r_b2 RADIOBUTTON GROUP r3 MODIF ID zz2.
"BLOQUE B.1
SELECTION-SCREEN BEGIN OF BLOCK b6 WITH FRAME TITLE text-t06.
PARAMETERS:p_b10 TYPE bsid-bukrs MODIF ID zb1,
p_b11 TYPE bsid-bukrs MODIF ID zb1.
SELECTION-SCREEN END OF BLOCK b6.
"BLOQUE B.2
SELECTION-SCREEN BEGIN OF BLOCK b7 WITH FRAME TITLE text-t07.
PARAMETERS:p_b20 TYPE bsid-bukrs MODIF ID zb2,
p_b21 TYPE bsid-bukrs MODIF ID zb2,
p_b22 TYPE bsid-bukrs MODIF ID zb2.
SELECTION-SCREEN END OF BLOCK b7.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN OUTPUT.
PERFORM ocultar_campos.
*&---------------------------------------------------------------------*
*& Form ocultar_campos
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM ocultar_campos.
"INPUT 0 = NO EDITABLE
"INPUT 1 = EDITABLE
"INVISIBLE 0 = VISIBLE
"INVISIBLE 1 = NO VISIBLE
IF r_a EQ 'X' AND r_a1 EQ 'X'. "BLOQUE A
LOOP AT SCREEN.
IF screen-group1 = 'ZZ2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF r_a EQ 'X' AND r_a2 EQ 'X'. "BLOQUE A
LOOP AT SCREEN.
IF screen-group1 = 'ZZ2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF r_b EQ 'X' AND r_b1 EQ 'X'. "BLOQUE B
LOOP AT SCREEN.
IF screen-group1 = 'ZZ1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF r_b EQ 'X' AND r_b2 EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'ZZ1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZB1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA1'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'ZA2'.
screen-INPUT = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " OCULTAR_CAMPOS