Wednesday, March 2, 2011

转:查找透明表的实用方法

1、通过字段查表:先通过SE16在表DD03L(保存有SAP所有字段)中通过字段查找到所有引用此字段的表名,再在表DD02L(保存有SAP所有表)中筛选表类别为透明表的表。可以做成一个Query,方便以后查询。其它相关表:DD02T(SAP表文本)、DD04T(数据元素文本)。另外,表DDFTX也有部分对应关系,但具体不清楚用在哪。

2、写个小程序,通过字段找表:

*****&&&&&查找透明表&&&&&*****
*&---------------------------------------------------------------------*
*& Report    ZTABLEFIND
*&
*&---------------------------------------------------------------------*
*& Author: Mao JH
*&
*&---------------------------------------------------------------------*

REPORT ztablefind.
TABLES: dd02t, dd03l, dd02l.
DATA: BEGIN OF field1 OCCURS 0.
        INCLUDE STRUCTURE dd03l.
DATA: END OF field1.
DATA: BEGIN OF field2 OCCURS 0.
        INCLUDE STRUCTURE dd03l.
DATA su TYPE i.
DATA: END OF field2.
DATA:field_sum TYPE i.

SELECT-OPTIONS ified FOR dd03l-fieldname.
SELECT-OPTIONS ittype FOR dd02l-tabclass.
DATA   fieldsum TYPE i.
SELECT * FROM dd03l INTO TABLE field1 WHERE fieldname IN ified.
SORT field1 BY tabname.
LOOP AT ified.

  fieldsum = sy-tabix.
ENDLOOP.
LOOP AT field1.
    field_sum = field_sum + 1.
  MOVE-CORRESPONDING field1 TO field2.
    AT END OF tabname.
*field2-tabname = field1-tabname.
*move-corresponding field1 to field2.
    field2-su = field_sum.
    COLLECT field2.
    CLEAR field2.
    CLEAR field_sum.
  ENDAT.
ENDLOOP.
LOOP AT field2 WHERE su = fieldsum.
    SELECT SINGLE * FROM dd02t WHERE tabname = field2-tabname AND
         ddlanguage = sy-langu.
    SELECT SINGLE * FROM dd02l WHERE tabname = field2-tabname AND
                      tabclass IN ittype AND
                      as4local =  field2-as4local AND
                      as4vers = field2-as4vers.
    IF sy-subrc = 0.
    WRITE: / field2-tabname,dd02l-tabclass,dd02t-ddtext.
  ENDIF.
ENDLOOP.



3、记录几个有用的表:

通用角色与本地角色的关系表:AGR_DEFINE

角色与事务代码的关系表:AGR_TCODES(用于查询角色中包含了哪些T-CODE,或一个T-CODE都被哪些角色使用)

这两个表是我用ST05追踪到的,记录一下。
原始来源:
http://blog.csdn.net/baiboyd/archive/2010/05/27/5629478.aspx

No comments:

Post a Comment