Look up tables/views for specific fields

This program extracts the tables list for given field names. On double clicking the table it will take you to SE11 .

This program extracts the tables list for given field names. On double clicking the table it will take you to...

SE11.

Note: If you are using this program in 4.0 then the parameter id used in the at line selection should be 'DOB' as againt 'DTB'.


REPORT ZLOOKTABLES LINE-SIZE 120 LINE-COUNT 60 .

TABLES : DD02L,
         DD03L,
         DD02T.

DATA : BEGIN OF I_DD02L OCCURS 0.
        INCLUDE STRUCTURE DD02L.
DATA : END OF I_DD02L.

DATA : BEGIN OF I_DD03L OCCURS 0,
        TABNAME LIKE DD03L-TABNAME,
        FIELDNAME LIKE DD03L-FIELDNAME,
        KEYFLAG LIKE DD03L-KEYFLAG,
        DDTEXT LIKE DD02T-DDTEXT,
  END OF I_DD03L.

DATA : COUNT TYPE I,
       DBCOUNT TYPE I,
       D_TABNAME LIKE DD03L-TABNAME.

DATA : BEGIN OF I_FLDNAME OCCURS 0,
         NAME(72),
       END OF I_FLDNAME.

SELECT-OPTIONS: FLDNAME FOR DD03L-FIELDNAME NO INTERVALS.

TOP-OF-PAGE.
  PERFORM HEADER.

START-OF-SELECTION.

  DESCRIBE TABLE FLDNAME LINES COUNT.
  SELECT * FROM DD03L INTO CORRESPONDING FIELDS OF DD03L
           WHERE FIELDNAME IN FLDNAME.
    I_DD03L-TABNAME = DD03L-TABNAME.
    I_DD03L-FIELDNAME = DD03L-FIELDNAME.
    I_DD03L-KEYFLAG = DD03L-KEYFLAG.
    APPEND I_DD03L.
  ENDSELECT.
  SORT I_DD03L BY TABNAME FIELDNAME.
  DBCOUNT = COUNT + 1.

  LOOP AT I_DD03L.
    AT NEW TABNAME.
      IF COUNT > DBCOUNT.
        DELETE I_DD03L WHERE TABNAME = D_TABNAME.
      ENDIF.
      DBCOUNT = 0.
    ENDAT.
    D_TABNAME = I_DD03L-TABNAME.
    DBCOUNT = DBCOUNT + 1.
    AT LAST.
      IF COUNT > DBCOUNT.
        DELETE I_DD03L WHERE TABNAME = D_TABNAME.
      ENDIF.
      DBCOUNT = 0.
    ENDAT.
  ENDLOOP.

  SELECT *  FROM DD02L INTO TABLE I_DD02L FOR ALL ENTRIES IN I_DD03L
            WHERE TABNAME = I_DD03L-TABNAME AND TABCLASS = 'TRANSP'.
  CLEAR I_DD03L.
  LOOP AT I_DD03L.
    SELECT SINGLE * FROM DD02T WHERE TABNAME = I_DD03L-TABNAME
    AND DDLANGUAGE = 'EN'.
    MOVE DD02T-DDTEXT TO I_DD03L-DDTEXT .
    MODIFY I_DD03L TRANSPORTING DDTEXT.
*  endselect.
  ENDLOOP.
  PERFORM PRINT.
  DATA : VALUE(25),                      " value For get cursor line
       FIELD(25),                      " For get cursor field
       LINE(4) ,                       " For get cursor line
       VALUE1(255).                    " value For get cursor field
AT LINE-SELECTION.
GET CURSOR FIELD FIELD VALUE VALUE.
GET CURSOR LINE LINE VALUE VALUE1.
CONDENSE VALUE .
CASE FIELD .
WHEN 'I_DD03L-TABNAME' .
SET PARAMETER ID 'DTB' FIELD VALUE(18).
CALL TRANSACTION 'SE11' AND SKIP FIRST SCREEN.
ENDCASE .

END-OF-SELECTION.

*---------------------------------------------------------------------*
*       FORM PRINT                                                    *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM PRINT.
  LOOP AT I_DD02L.
    LOOP AT I_DD03L WHERE TABNAME = I_DD02L-TABNAME.
      AT NEW TABNAME.
        SKIP 1.
        WRITE : /  I_DD03L-TABNAME.
        ULINE.
      ENDAT.
     WRITE : /02 I_DD03L-KEYFLAG,06 I_DD03L-FIELDNAME,38 I_DD03L-DDTEXT.
    ENDLOOP.
  ENDLOOP.
ENDFORM.


*---------------------------------------------------------------------*
*       FORM CONCAT                                                   *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  VALUE(P_0062)                                                 *
*---------------------------------------------------------------------*
FORM CONCAT USING    VALUE(P_0062).
  CONCATENATE 'FIELDNAME = ''' P_0062 ''''  INTO I_FLDNAME.
  APPEND I_FLDNAME. CLEAR I_FLDNAME.
  CONCATENATE 'AND' ' ' INTO I_FLDNAME.
  APPEND I_FLDNAME.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  CONCAT1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FLDNAME+3(28)  text                                        *
*      -->P_PERFORM  text                                              *
*      -->P_CONCAT  text                                               *
*      -->P_FLDNAME+3(28)  text                                        *
*----------------------------------------------------------------------*
FORM CONCAT1 USING VALUE(VAL1).
  CONCATENATE 'FIELDNAME = ''' VAL1 ''''  INTO I_FLDNAME.
  APPEND I_FLDNAME. CLEAR I_FLDNAME.
ENDFORM.                               " CONCAT1

*---------------------------------------------------------------------*
*       FORM HEADER                                                   *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM HEADER.
  FORMAT COLOR COL_HEADING.
  WRITE : / 'Tablename'.
  WRITE : /02 'Key' ,06 'Field Name', 30 'Description' .

  ULINE.
  FORMAT RESET.

ENDFORM.
This was last published in October 2001

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close