SAP 散装笔记 第 20240702 号 QA 问答摘选
简介: 每隔一段时间,我会整理一份问答摘选的散装笔记,笔记来源博客、公众号、知识星球、微信、 QQ 等地方,也可能来自 SAP Support 和 Community。这是第 20240702 号 QA 问答摘选,希望这些问答对你有所帮助。
关键字:SAP
ABAP
散装笔记
QA
问答摘选
D010INC
性能调优
AGR_USERS
1 性能调优 for all entries in 老坑重提
- 问:今天在改一个效率很慢的报表,最后才发现是 for all entries in 的表中,关联字段有空值(初始值)的原因,真是个很容易跳进去的坑,给大家打下预防针。
- 答:下面是
性能调优
的过程。
原程序:
if lt_docflow[] is not initial.
select * into corresponding fields of table lt_docflow
from zpdom_docflow
for all entries in lt_docflow
where tasno = lt_docflow-tasno.
endif.
看起来没什么问题是不是?
因为语法上确实没问题,我们看看内表数据,关联的字段有空值(初始值)!技术角度上,也没有问题,但在业务角度上是有问题的。
因为这张表是凭证流表,里面的数据不是结构化的,类似层次结构,这样查询导致的结果是,将很多非期望的数据都取出来了。
如何改进:
定义连接字段的内表 B,将有效值转移到内表中,再用内表 B 去关联查询 for all entries in 内表 B
。
改进代码,
data:lt_tasno type table of zsks_pdo_tasno with header line.
move-corresponding lt_docflow[] to lt_tasno[].
delete lt_tasno where tasno is initial.
if lt_tasno[] is not initial.
select * into corresponding fields of table lt_docflow
from zpdom_docflow
for all entries in lt_tasno
where tasno = lt_tasno-tasno.
endif.
小结:一般情况下不会遇到这种情况,只有类似本例的场景,才会碰到。
2 根据数据表名称快速找到维护视图和配置项
- 问:我找到了一个数据表
T158
,看起来是个配置表,我怎样才能快速找到他维护视图和配置项? - 答:使用事务码
SM30
,输入数据表T158
,- (1)查找