Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all tables in ABAP programmatically?

Tags:

abap

All tables may be listed with t-code SE16 and table DD02L. But how can that list be accessed programmatically?

like image 911
alex Avatar asked Dec 08 '25 16:12

alex


2 Answers

It is rarely a good idea to access the database tables directly since you will have to deal with all kinds of technicalities you probably don't even know about - active / inactive versions, for example. You will also bypass all security and authorization checks, which might be irrelevant to you personally, but is undesirable in general. To get a list of tables, you can use the function module RPY_TABLE_SELECT. This function module will take care of the version handling and provide the description in the language of your choice as well.

like image 170
vwegert Avatar answered Dec 10 '25 05:12

vwegert


Improved Alex code in some way and put it as an option:

SELECT tabname
 FROM DD02L 
 INTO TABLE @DATA(itab)
WHERE TABCLASS = 'TRANSP'.

LOOP AT itab ASSIGNING FIELD-SYMBOL(<FS>).
 WRITE:/ <FS>.
ENDLOOP.

Several things were refined: incline declarations were utilized, field-symbols added, SELECT * and WHERE IN were omitted and so on.
Also tables in SAP have only TRANSP class, INTTAB class belongs to structures.

Note: the sample is functional since ABAP 7.40, SP08.

like image 30
Suncatcher Avatar answered Dec 10 '25 06:12

Suncatcher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!