简体   繁体   English

如何按字段数过滤 SAP 表?

[英]How to filter the SAP tables by the number of fields?

SAP table DD02L lists, for each table in SAP, among others, the number of fields in each table. SAP 表 DD02L 为 SAP 中的每个表列出了每个表中的字段数。 For example table, PLPO (PM task lists) contains 244 fields, according to T-Code S_PH0_48000138.例如表,根据 T-Code S_PH0_48000138,PLPO(PM 任务列表)包含 244 个字段。 For business reporting and using SQL, I only want to see 5, 6 field values at most, but the entire table is replicated, all 244 fields!业务报表,使用SQL,我最多只想看5、6个字段值,但是整个表都复制了,全244个字段!

So, I want to know how many transparent tables consist of more than say, 20 fields.所以,我想知道有多少个透明表包含超过 20 个字段。 if I run the above t-code, it will take me 10 years, to do one table at a time.如果我运行上面的 t 代码,我将花费 10 年的时间,一次只做一张表。

Mike McNally迈克·麦克纳利

I am not an experienced ABAPer, so I do not know how to set this up.我不是经验丰富的 ABAPer,所以我不知道如何设置。

Table DD02L is "only" a list of all tables in SAP.表 DD02L“只是”SAP 中所有表的列表。 I have not found any field in this table, which would tell, how many field the actual table has.我没有在该表中找到任何字段,这可以说明实际表有多少字段。

What could be used is table DD03L (SAP table fields), which lists all fields and tables in SAP.可以使用表DD03L(SAP 表字段),它列出了SAP 中的所有字段和表。 The fields are listed by position, which means we can select all tables where a field with position 21 exists (position 21 exists = there are more than 20 fields in the table):字段由position列出,这意味着我们可以 select 所有存在字段为 position 21 的表(位置 21 存在 = 表中有超过 20 个字段):

SELECT FROM dd02l
       INNER JOIN dd03l
       ON dd02l~tabname  EQ dd03l~tabname  AND
          dd02l~as4local EQ dd03l~as4local AND
          dd02l~as4vers  EQ dd03l~as4vers
       FIELDS dd02l~tabname
       WHERE dd02l~tabclass EQ 'TRANSP' "only transparent tables
         AND dd03l~position EQ '0021'
       INTO TABLE @DATA(lt_dd02l).

The result (internal table lt_dd02l) will contain all the tables, which have more than 20 fields.结果(内部表 lt_dd02l)将包含所有具有 20 多个字段的表。 I am on an R/3 system currently, the query took a few seconds only, but there are still over 12.000 tables with more than 20 fields.我目前在 R/3 系统上,查询只用了几秒钟,但仍然有超过 12.000 个表和 20 多个字段。

*Answer edited after the comment from Gert Beukema (see below) *在 Gert Beukema 的评论后编辑的答案(见下文)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM