Back to Main Index

ABAP Program to Display SAP Dictionary Table Information

The SAP transaction SE11 displays all the field information in a great detail. If only we could download the information into a file... or be able to search for a string...

The ABAP program below fulfills the above wishes. It is basically a report so you can download the output and search for a specific string.

You can supply a single table name (e.g., KNA1) in the selection screen. You can also run this program against multiple tables but the table names should come from an external file. Double clicking on the highlighted table name takes you to SE11 on that table!

I have the following text elements defined:
TEXT-001 = Specify a single table name here, or hit F8 to specify a
TEXT-002 = file name containing table names.

ABAP Code

REPORT ZTBLINFO LINE-SIZE 80.

TABLES: DD02L,
        DD02T,
        DD03L,
        DD04T.

DATA: BEGIN OF ITAB_TABLES OCCURS 0,
          TABNAME LIKE DD02L-TABNAME,
      END OF ITAB_TABLES.

DATA: FILEOPENCANCELLED.

SELECTION-SCREEN: COMMENT 1(80) TEXT-001, SKIP 1,
                  COMMENT 1(80) TEXT-002, SKIP 1.
PARAMETER: TBLNAME LIKE DD02L-TABNAME.

IF TBLNAME IS INITIAL.
  CALL FUNCTION 'UPLOAD'
       EXPORTING
            FILENAME = 'tablenames.txt'
       IMPORTING
            CANCEL   = FILEOPENCANCELLED
       TABLES
            DATA_TAB = ITAB_TABLES.
  IF NOT FILEOPENCANCELLED IS INITIAL.
    EXIT.
  ENDIF.
ELSE.
  CLEAR ITAB_TABLES. REFRESH ITAB_TABLES.
  ITAB_TABLES-TABNAME = TBLNAME.
  APPEND ITAB_TABLES.
ENDIF.

SORT ITAB_TABLES.
DELETE ADJACENT DUPLICATES FROM ITAB_TABLES.
TRANSLATE ITAB_TABLES-TABNAME TO UPPER CASE.

SELECT TABNAME DDTEXT FROM DD02T
       INTO CORRESPONDING FIELDS OF DD02T
       FOR ALL ENTRIES IN ITAB_TABLES
       WHERE TABNAME = ITAB_TABLES-TABNAME AND
             DDLANGUAGE = 'E'.
  FORMAT COLOR COL_KEY.
  WRITE: / 'N ' AS SYMBOL,
                DD02T-TABNAME RIGHT-JUSTIFIED, '-', DD02T-DDTEXT,
           '? ' AS SYMBOL.
  HIDE DD02T-TABNAME.
  FORMAT COLOR OFF.
  SELECT FIELDNAME ROLLNAME DATATYPE LENG DOMNAME FROM DD03L
         INTO CORRESPONDING FIELDS OF DD03L
         WHERE TABNAME = DD02T-TABNAME.
    SELECT DDTEXT FROM DD04T
           INTO CORRESPONDING FIELDS OF DD04T
           WHERE ROLLNAME = DD03L-ROLLNAME AND
                 DDLANGUAGE = 'E'.
      WRITE: /
            DD03L-FIELDNAME, DD03L-ROLLNAME,
            DD03L-DATATYPE, DD03L-LENG NO-ZERO,
            DD03L-DOMNAME, (35) DD04T-DDTEXT.
    ENDSELECT.
  ENDSELECT.
  ULINE.
ENDSELECT.
CLEAR DD02T-TABNAME.

AT LINE-SELECTION.
  IF NOT DD02T-TABNAME IS INITIAL.
    call function 'RS_DD_DEF_SHOW'
        EXPORTING
            OBJNAME              = DD02T-TABNAME.
  ENDIF.
  CLEAR DD02T-TABNAME.