Thursday, November 30, 2006

Ocultar Selection-Screens


Más de una vez (Yo incluído), me ha preguntado como hacer para ocultar o mostrar un Selection-Screen...Tal como hacen algunas transacciones de SAP...La respuesta es más sencilla de lo que parece -;)

**************************************************************
* Programa: ZDUMMY_TEST. *
* Consultor ABAP: Alvaro Tejada Galindo *
**************************************************************
REPORT ZPRUEBA_ATG.

DATA: FLAG TYPE C VALUE 'X',
COUNTER TYPE I.

SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECTION-SCREEN PUSHBUTTON 1(10) BUTTON USER-COMMAND GOCFG.
SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-T01.
PARAMETERS:
CARRID TYPE SPFLI-CARRID MODIF ID SC1,
CONNID TYPE SPFLI-CONNID MODIF ID SC1,
CITYFROM TYPE SPFLI-CITYFROM MODIF ID SC1.
SELECTION-SCREEN END OF BLOCK B2.

*&-----------------------------------------------------------&*
*& START-OF-SELECTION &*
*&-----------------------------------------------------------&*
START-OF-SELECTION.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'SC1' AND FLAG EQ 'X'.
COUNTER = COUNTER + 1.
WRITE 'Ocultar' TO BUTTON.
SCREEN-ACTIVE = '1'.
MODIFY SCREEN.
IF COUNTER EQ 6.
CLEAR COUNTER.
FLAG = SPACE.
ENDIF.
CONTINUE.
ELSEIF SCREEN-GROUP1 = 'SC1' AND FLAG EQ SPACE.
COUNTER = COUNTER + 1.
WRITE 'Mostrar' TO BUTTON.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
IF COUNTER EQ 6.
CLEAR COUNTER.
FLAG = 'X'.
ENDIF.
CONTINUE.
ENDIF.
ENDLOOP.




Saludos,

Blag.

No comments: