*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. Druid参考配置

    pom中的maven dependency <dependency>            <groupId>com.alibaba</groupId>       ...

  2. 06——react组件的基本定义和使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. Leetcode 题解 Longest Substring Without Repeating Characters_需要重做

    最长的没有重复的字符串. 这个题其实不难.但是我第二次做了,硬是把它做出了难的感觉... 变量命名要合理.可读性强.

  4. 尚硅谷springboot学习2-微服务

    2014年,martin flowler发表关于微服务的博客 微服务是一种架构风格:一个应用应该是一组小型服务:可以通过HTTP的方式进行互通: 单体应用:ALL IN ONE 微服务:每一个功能元素 ...

  5. Nginx缓存配置以及nginx ngx_cache_purge模块的使用

    web缓存位于内容源Web服务器和客户端之间,当用户访问一个URL时,Web缓存服务器会去后端Web源服务器取回要输出的内容,然后,当下一个请求到来时,如果访问的是相同的URL,Web缓存服务器直接输 ...

  6. 【379】pandas 说明

    参考:Part 1 参考:Part 2

  7. 11.mysql-权限.md

    目录 -- ***********五.mysql权限问题**************** -- mysql数据库权限问题:root :拥有所有权限(可以干任何事情) -- 权限账户,只拥有部分权限(C ...

  8. 吴裕雄 python 机器学习-DMT(2)

    import matplotlib.pyplot as plt decisionNode = dict(boxstyle="sawtooth", fc="0.8" ...

  9. webui-popover 一个轻量级的jquery弹出层插件

    该提示框插件可以和Bootstrap完美结合,但是并不一定需要和Bootstrap一起使用.它支持IE7以上的浏览器. 首先要引入需要的css  js  文件 <link rel="s ...

  10. windows下搭建vue

    1.windows https://nodejs.org/en/download/ 下载安装包2.点击安装 安装完成3.进入cmd npm -v4.安装淘宝镜像cnpm npm下载速度过慢因为安装完n ...