*low efficiency
l_it_alv_stpox[] = g_it_alv_stpox[].
SORT l_it_alv_stpox BY zz_matnr idnrk.
LOOP AT g_it_alv_stpox ASSIGNING <l_wa_alv>.
LOOP AT l_it_alv_stpox WHERE ( zz_matnr NE <l_wa_alv>-zz_matnr )
AND ( idnrk EQ <l_wa_alv>-idnrk )
AND ( zz_bunit IS NOT INITIAL )
AND ( zz_bunit NE <l_wa_alv>-zz_bunit ).
<l_wa_alv>-zz_bunit = 'Common'.
EXIT.
ENDLOOP.
UPDATE marc SET zz_bunit = <l_wa_alv>-zz_bunit WHERE werks = <l_wa_alv>-werks
AND matnr = <l_wa_alv>-idnrk .
IF sy-subrc EQ 0.
COMMIT WORK.
<l_wa_alv>-zz_message = l_message_s.
ELSE.
ROLLBACK WORK.
<l_wa_alv>-zz_message = l_message_f.
ENDIF.
ENDLOOP.

***大内表LOOP嵌套LOOP,速度太慢,转化成以下逻辑 ***

 delete adjacent duplicates from g_it_alv_stpox comparing zz_matnr idnrk.
l_it_idnrk_stpox[] = g_it_alv_stpox[].
sort l_it_idnrk_stpox by idnrk.
delete adjacent duplicates from l_it_idnrk_stpox comparing idnrk. l_it_both_stpox[] = l_it_idnrk_stpox[]. loop at l_it_idnrk_stpox into l_wa_idnrk_stpox.
l_it_stpox_in_loop[] = l_it_both_stpox[].
delete l_it_stpox_in_loop where idnrk ne l_wa_idnrk_stpox-idnrk.
delete l_it_both_stpox where idnrk eq l_wa_idnrk_stpox-idnrk.
describe table l_it_stpox_in_loop lines l_lines.
if l_lines gt 1.
l_wa_idnrk_stpox-zz_bunit = 'Common'.
endif.
clear l_lines.
update marc set zz_bunit = l_wa_idnrk_stpox-zz_bunit where werks = l_wa_idnrk_stpox-werks
and matnr = l_wa_idnrk_stpox-idnrk.
if sy-subrc eq 0.
commit work.
l_wa_idnrk_stpox-zz_message = l_message_s.
else.
rollback work.
l_wa_idnrk_stpox-zz_message = l_message_f.
endif. modify g_it_alv_stpox from l_wa_idnrk_stpox transporting zz_bunit zz_message
where werks = l_wa_idnrk_stpox-werks and idnrk = l_wa_idnrk_stpox-idnrk.
endloop.
clear:l_wa_idnrk_stpox.

***上面一段有误,改成以下 ***

sort lt_stpox by idnrk zz_bunit.
delete adjacent duplicates from lt_stpox comparing idnrk zz_bunit.
describe table lt_stpox lines l_lines.
endif.
* PERFORM frm_check_users.
write: 'LT_STPOX lines:' , l_lines. lt_mara[] = lt_stpox[].
sort: lt_mara by idnrk.
delete adjacent duplicates from lt_mara comparing idnrk . sort: lt_stpox by idnrk. describe table lt_mara lines l_lines.
write: 'LT_MARA:' , l_lines. loop at lt_mara into ls_mara.
l_maraindex = sy-tabix.
read table lt_stpox into ls_stpox with key idnrk = ls_mara-idnrk binary search.
if sy-subrc = 0.
l_index = sy-tabix.
loop at lt_stpox into ls_stpox from l_index.
if ls_stpox-idnrk ne ls_mara-idnrk.
exit.
endif.
if ls_stpox-zz_bunit ne ls_mara-zz_bunit.
ls_mara-zz_bunit = 'Common'.
exit.
endif. endloop. update marc set zz_bunit = ls_mara-zz_bunit where werks = p_werks
and matnr = ls_mara-idnrk.
if sy-subrc eq 0.
commit work.
else.
rollback work.
endif.
write: /.
write:l_maraindex, ls_mara-idnrk, ls_mara-zz_bunit. endif.
endloop.

Efficiency optimizing的更多相关文章

  1. Android 性能优化(9)网络优化( 5)Optimizing Server-Initiated Network Use

    Optimizing Server-Initiated Network Use This lesson teaches you to Send Server Updates with GCM Netw ...

  2. Android 性能优化(8)网络优化( 4)Optimizing App-Initiated Network Use

    Optimizing App-Initiated Network Use This lesson teaches you to Batch and Schedule Network Requests ...

  3. Optimizing web servers for high throughput and low latency

    转自:https://blogs.dropbox.com/tech/2017/09/optimizing-web-servers-for-high-throughput-and-low-latency ...

  4. WWDC2018 之 优化 App Assets Optimizing App Assets

    该篇博客记录了观看WWDC Session227<Optimizing App Assets>的内容以及一些理解. 引言 该session主要讲述了使用Assets Catalog的新特性 ...

  5. Unity性能优化(3)-官方教程Optimizing garbage collection in Unity games翻译

    本文是Unity官方教程,性能优化系列的第三篇<Optimizing garbage collection in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...

  6. Unity性能优化(4)-官方教程Optimizing graphics rendering in Unity games翻译

    本文是Unity官方教程,性能优化系列的第四篇<Optimizing graphics rendering in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...

  7. Design and Analysis of Algorithms_Fundamentals of the Analysis of Algorithm Efficiency

    I collect and make up this pseudocode from the book: <<Introduction to the Design and Analysis ...

  8. 帕雷托最优(Pareto optimality)、帕雷托效率(Pareto efficiency)

    帕雷托最优(英语:Pareto optimality),或帕雷托最适,也称为帕雷托效率(英语:Pareto efficiency),是经济学中的重要概念,并且在博弈论.工程学和社会科学中有着广泛的应用 ...

  9. Optimizing Performance: Data Binding(zz)

    Optimizing Performance: Data Binding .NET Framework 4.5 Other Versions   Windows Presentation Founda ...

随机推荐

  1. ACM__01背包,完全背包,多重背包

    今天写题的时候碰到了一道完全背包题,可是没有看出来,乱写了一通,浪费了一个晚上,顺便复习一下背包的知识 01背包 每种物品只能选择一次或者不选,求背包容量内的最大价值 先给出状态转移方程: f[i][ ...

  2. ELK实时日志分析平台环境部署--完整记录(转)

    在日常运维工作中,对于系统和业务日志的处理尤为重要.今天,在这里分享一下自己部署的ELK(+Redis)-开源实时日志分析平台的记录过程(仅依据本人的实际操作为例说明,如有误述,敬请指出)~ ==== ...

  3. js总结001

    JSTL 表达式与 EL 语言      http://leon906998248.iteye.com/blog/1502569 2   jquery中$each()方法的使用指南     http: ...

  4. git 每次push都需要输入用户和密码

    git remote -v origin https://github.com/userName/xx.git (fetch) origin https://github.com/userName/x ...

  5. RabbitMQ系列教程之六:远程过程调用(RPC)(转载)

    RabbitMQ系列教程之六:远程过程调用(RPC) 远程过程调用(Remote Proceddure call[RPC]) (本实例都是使用的Net的客户端,使用C#编写) 在第二个教程中,我们学习 ...

  6. python实现排序算法二:归并排序

    ##归并排序 ##基本思想:对于两个排好序的数组A和B,逐一比较A和B的元素,将较小值放入数组C中,当A或者B数组元素查询完后,将A或者B剩余的元素直接添加到C数组中,此时C数组即为有序数组,这就是归 ...

  7. TFS登录时保存了用户密码,如何用其他账户登录

      来源:http://blog.csdn.net/littlegreenfrog/article/details/5254633 使用TFS2008过程中,常常由于已经保存用户名和密码,却没有重新登 ...

  8. 漫谈C指针:参数传递的三道题目

    漫谈C指针:参数传递的三道题目 2009-07-02 开讲之前,我先请你做三道题目.(嘿嘿,得先把你的头脑搞昏才行……唉呀,谁扔我鸡蛋?) 考题一,程序代码如下: [c] view plaincopy ...

  9. Hibernate 再接触 CRUD

    1.save 一对多双向 package com.bjsxt.hibernate; import java.util.HashSet; import java.util.Set; import jav ...

  10. oracle 连接池参数

    后来排查出数据库监听异常,发现是ORA-12519拒绝错误.后来发现是数据的连接池达到的极致. 具体解决方案如下: --首先检查process和session的使用情况,在sqlplus里面查看. S ...