Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2895

Re: How to get all the tables and table fields in SAP

$
0
0

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


Viewing all articles
Browse latest Browse all 2895

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>