*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. leetcode 题解: Gray Code

    第一眼看到就是枚举,回溯法. n位的ans就是在n-1的ans的基础上,每一个在首位加上1. 但是有个难点,要保证相邻两数之间只有一位在变化,怎么办? 首先 00 00 01 00 01 11 10 ...

  2. Error building Player: Exception: Could not start java

    4.6.1发布Flash版本出错.解决方法:把C:\Windows\System32\java.exe复制到C:\Windows\SysWOW64下即可

  3. 一次docker中的nginx进程响应慢问题定位记录

    有个ft测试的环境,其中nginx使用docker发布的.测试用例是curl的时候,没有获得nginx的响应. docker ps CONTAINER ID IMAGE COMMAND CREATED ...

  4. How to Pronounce We’ll Contraction

    How to Pronounce We’ll Contraction Share Tweet Share Tagged With: WILL Contractions There are severa ...

  5. 判断页面是否添加了W3C声明

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Android进阶AIDL - 2018年4月14日

    参考:慕课网 --- 最后三集.Android开发艺术探索 1.在AS中创建aidl文件后,要编译一下才会在gen下生成debug文件: 2.AIDL 不支持short类型,常用的数据类型: 3.AI ...

  7. c++之enum的好处与 define 的区别

    转载自 https://blog.csdn.net/zhh464626057/article/details/41038933 什么时候需要用到enum呢?就是变量的数值在几个范围之间.red,blu ...

  8. oracle 连接池参数

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

  9. jsonp封装成promise

    首先将jsonp通过npm 安装引入js文件中,代码如下 import originJsonp from 'jsonp' export default function jsonp(url, data ...

  10. flume kafka 配置指南

    1.官方网站也有配置: https://flume.apache.org/FlumeUserGuide.html#kafka-source 2.clodera 官方配置 https://www.clo ...