Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get all the tables and table fields in SAP

Former Member
0 Kudos

Hi All,

I want to get all table fields of all tables which are configured and have data in them,

I tried using DD03L but I am also getting a lot of structures and structure fields. What I would want is all the table fields of table which have data in SAP ISU.

2 REPLIES 2

former_member195402
Active Contributor
0 Kudos

Hi,

to get all the fields that may have data, you can use an ABAP code like

REPORT z_list_table_fields.

                                

TYPES: BEGIN OF t_field,

         tabname   TYPE dd02l-tabname,

         position  TYPE dd03l-position,

         fieldname TYPE dd03l-fieldname,

       END   OF t_field.

                                

DATA: gv_table     TYPE dd02l-tabname.

DATA: gt_fields    TYPE SORTED TABLE OF t_field

                   WITH UNIQUE KEY tabname position.

                                

FIELD-SYMBOLS: <gwa_fields> TYPE t_field.

                                

SELECT-OPTIONS: so_table FOR gv_table DEFAULT 'VBA+' OPTION CP SIGN I.

START-OF-SELECTION.

                                

  SELECT dd02l~tabname dd03l~position dd03l~fieldname

                                             FROM  dd02l

                                      INNER  JOIN  dd03l

                                               ON  dd03l~tabname  = dd02l~tabname

                                              AND  dd03l~as4local = dd02l~as4local

                                              AND  dd03l~as4vers  = dd02l~as4vers

                                             INTO  CORRESPONDING FIELDS  OF  TABLE gt_fields

  WHERE  dd02l~tabname                         IN  so_table

  AND    dd02l~as4local                        EQ  'A'

  AND    dd02l~as4vers                         EQ  '0000'

  AND    dd02l~tabclass                        IN  ( 'TRANSP', 'POOL', 'CLUSTER' )

  AND    dd03l~precfield                       EQ  space. "filled for append and include structure names

                                                                                                                                                                                                                                                              

  LOOP                                         AT  gt_fields

                                        ASSIGNING  <gwa_fields>.

    WRITE:  /1                                     <gwa_fields>-tabname,

                                                   <gwa_fields>-fieldname.

    AT  END                                    OF  tabname.

      ULINE.

    ENDAT.

  ENDLOOP.

If you want to have only tables listed, that are not empty, you can enhance this code with a SELECT on the table. You can enhance this code on field content, too, but this may become very slow.

Regards,

Klaus

Former Member

Hi Jowin,

Try with FM - SACC_DDIC_INFO_READ.

Regards,

Siddharth Shah