REPORT ZZBGS044 MESSAGE-ID Z1 LINE-COUNT 65 LINE-SIZE 132
                NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* Description: This program list all tables in        regards to the   *
*              selection criteria.                                     *
*                                                                      *
* Customizing: You need not to make any customizing to use this program*
*                                                                      *
* Change of    You only have to check that tables, functions and       *
* release:     includes till exists. Bedst just to check and run the   *
*              program.                                                *
*                                                                      *
* Programmer:  Benny G. Sørensen                                       *
* Date:        July 1995                                               *
*                                                                      *
* SAP R/3      2.2F                                                    *
*-------------------------------Corrections----------------------------*
* Date        Userid     Correction                                    *
* xx-xx-xxxx  xxxxxxxxx  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *
*----------------------------------------------------------------------*
TABLES: DD02V                "SAP tables view
        .
DATA: BEGIN OF DYNTAB OCCURS 2000.
        INCLUDE STRUCTURE BDCDATA.
DATA: END OF DYNTAB.
DATA: BEGIN OF TABLES OCCURS 100.
        INCLUDE STRUCTURE DD02V.
DATA: END OF TABLES.
DATA: L        TYPE I,
      REPL(30) TYPE C VALUE '????????????????????????????'.
FIELD-SYMBOLS: <P>.


PARAMETERS:
  TABLE(30)    TYPE C,
  TITLE(74)       TYPE C LOWER CASE DEFAULT ' ',
  DOWNLOAD(1)     TYPE C DEFAULT ' ',
  FILENAME(65)    TYPE C DEFAULT 'c:\SAP\DOC\?',
  EXCEPT(30)      TYPE C DEFAULT ' '.

START-OF-SELECTION.
  IF TABLE = ''.
     TABLE = '*' .
  ENDIF.
  IF TITLE = ''.
     TITLE = '*' .
  ENDIF.
  TRANSLATE TABLE    USING '*%'.
  TRANSLATE TITLE    USING '*%'.
  CONDENSE EXCEPT NO-GAPS.
  L = STRLEN( EXCEPT ).
  IF L > 0.
    ASSIGN REPL(L) TO <P>.
  ENDIF.

  SELECT * FROM DD02V INTO TABLES
    WHERE DDLANGUAGE = SY-LANGU
      AND TABNAME  LIKE TABLE
      AND DDTEXT   LIKE TITLE.
    HIDE DD02V-TABNAME.

    IF EXCEPT NE ''.
      REPLACE EXCEPT LENGTH L WITH
              <P>    INTO TABLES-TABNAME.
    ENDIF.

    TRANSLATE TABLE USING '% '.
    CONDENSE TABLE NO-GAPS.
    IF TABLES-TABNAME CS TABLE.
      WRITE:/ TABLES-TABNAME, '   ', TABLES-DDTEXT.
      APPEND TABLES.
    ENDIF.
  ENDSELECT.

  IF DOWNLOAD NE ''.
    CALL FUNCTION 'WS_DOWNLOAD'
      EXPORTING
        FILENAME     = FILENAME
        FILETYPE     = 'WK1'   "ASC, WK1, DBF, DAT, bin
      TABLES
        DATA_TAB     = TABLES.
  ENDIF.

AT LINE-SELECTION.
  SET PARAMETER ID 'DOB' FIELD SY-LISEL(30) .
  CALL TRANSACTION 'SE12' AND SKIP FIRST SCREEN.

AT PF8.
  CHECK SY-LISEL <> ''.
  SET PARAMETER ID 'DTB' FIELD SY-LISEL(10) .
  REFRESH  DYNTAB.
  PERFORM DYNPRO USING:
     'X'  'SAPMSTAZ'     '0100'        "Selection screen
    ,' '  'DD02V-TABNAME'  SY-LISEL(10).
  CALL TRANSACTION 'SE16' USING DYNTAB MODE 'A' .


FORM DYNPRO USING DYNBEGIN NAME VALUE.

  IF DYNBEGIN = 'X'.
    CLEAR DYNTAB.
    MOVE :  NAME TO DYNTAB-PROGRAM,
            VALUE TO DYNTAB-DYNPRO,
            DYNBEGIN TO DYNTAB-DYNBEGIN.
    APPEND DYNTAB.
  ELSE.
    CLEAR DYNTAB.
    MOVE:  NAME TO DYNTAB-FNAM,
           VALUE TO DYNTAB-FVAL.
    APPEND DYNTAB.
  ENDIF.

ENDFORM.