SELECT OPTIONS DINÁMICOS

19 04 2009

Con el siguiente código podremos crear pantallas de entrada de datos dinámicas. Donde según el radio button que se elija, aparecerán distintos filtros de selección.

image 

image

 

TABLES: KNA1, MARA.

************************************************************************
*** SELECTION-SCREEN / PARAMETERS / SELECT-OPTIONS                   ***
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-A01.
PARAMETERS:
            R_CLIE  RADIOBUTTON GROUP GRUP USER-COMMAND R DEFAULT ‘X’,
            R_MATE  RADIOBUTTON GROUP GRUP.
SELECTION-SCREEN END OF BLOCK B1.

*Datos Clientes
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-B02.
SELECT-OPTIONS: SO_CLIE  FOR KNA1-KUNNR MODIF ID CLI,
                SO_NAME  FOR KNA1-NAME1 MODIF ID CLI,
                SO_LAND  FOR KNA1-LAND1 MODIF ID CLI.
SELECTION-SCREEN END OF BLOCK B2.

*Datos Materiales
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-B03.
SELECT-OPTIONS: SO_MATE FOR MARA-MATNR NO INTERVALS NO-EXTENSION MODIF ID MAT.
SELECTION-SCREEN END OF BLOCK B3.

*———————————————————————–*
*AT SELECTION-SCREEN.
*———————————————————————–*

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF SCREEN-GROUP1 = ‘MAT’.
      CASE R_MATE.
        WHEN ‘X’.
          SCREEN-ACTIVE = 1.
        WHEN OTHERS.
          SCREEN-ACTIVE = 0.
      ENDCASE.
    ELSEIF SCREEN-GROUP1 = ‘CLI’.
      CASE R_MATE.
        WHEN ‘X’.
          SCREEN-ACTIVE = 0.
        WHEN OTHERS.
          SCREEN-ACTIVE = 1.
      ENDCASE.
    ENDIF.

    MODIFY SCREEN.

  ENDLOOP.


Technorati tags: