How to get table list belonging to a given package and all its sub packages

版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons

https://wiki.scn.sap.com/wiki/display/TechTSG/How+to+get+table+list+belonging+to+a+given+package+and+all+its+sub+packages

Created by Jerry Wang, last modified on Sep 02, 2016 Go to start of metadata

Suppose the requirement is to get all database tables belonging to package COM_PRODUCT_BASE and its sub packages. Since COM_PRODUCT_BASE contains no database tables not only sub packages:

Since Repository information system does not support query against sub packages:

Here below is an ABAP code snippet which can help you get table list: method GET_TABLE_LIST.

DATA: t_descendant TYPE cl_pak_package_queries=>tt_subpackage_info,
lt_result TYPE STANDARD TABLE OF tadir-obj_name.
CALL METHOD cl_pak_package_queries=>get_all_subpackages
EXPORTING
im_package = iv_package_name
IMPORTING
et_subpackages = t_descendant
EXCEPTIONS
OTHERS = 1.
CHECK sy-subrc = 0.
SELECT obj_name INTO TABLE lt_result FROM TADIR as dir INNER JOIN dd02l as tt ON dir~obj_name
= tt~tabname
FOR ALL ENTRIES IN t_descendant
WHERE pgmid = 'R3TR' and object = 'TABL' AND tt~tabclass = 'TRANSP'
AND devclass = t_descendant-package .
endmethod.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券