abap

How to retrieve a list of tables which are in my SAP system with ABAP program?


I need to retrieve a list of tables which are in my SAP system, can someone explain how to make this? I am new with ABAP. I have to write a program for this with input field for table name and value search.

Thank you.


Solution

  • You can query the following SAP tables to get the data:

    • DD02L SAP Tables: information about the tables
    • DD02T SAP Table Texts: table descriptions

    By selecting the data from DD02L you can put additional conditions to retrieve the tables you need. Most probably you may want to restrict the query to get:

    • only custom tables:
      ( tabname LIKE 'Z%' OR tabname LIKE 'Y%' )
    • only activated tables, i. e. entries activated or generated in this form:
      as4local = 'A'
    • only database tables TRANSP and / or structures INTTAB:
      tabclass IN ('TRANSP', 'INTTAB')

    So you can start with the query:

      SELECT * FROM dd02l INTO TABLE @DATA(lt_tables)
         WHERE ( tabname LIKE 'Z%' OR tabname LIKE 'Y%' )
           AND as4local = 'A'
           AND tabclass IN ('TRANSP', 'INTTAB').
    

    and develop it further as you need according to your requirements.