*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. HTML Tables

    Great job! In this lesson, you learned how to create a table, add data to it, and section the table ...

  2. sqoop连接SqlServer2012示例

    sqoop import --connect 'jdbc:sqlserver://192.168.xx.xx:1433;username=sa;password=xxxx;database=WindE ...

  3. Zeosdbo-Query使用

    with DataModule1.Zlxz_zy_Query do        begin          Close;          SQL.Clear;          SQL.Add( ...

  4. 八皇后问题C语言解法

    偶遇八皇后问题,随即自己写了一个仅供参考 #include<stdio.h> #include<math.h> #define SIZE 8 void Circumsribe( ...

  5. img标签插入图片返回403,浏览器可以直接打开

    参考:https://segmentfault.com/q/1010000011752614/a-1020000011764026 博客园引入外部图片出现,出现403问题,应该是加了防盗链,会检测访问 ...

  6. Delphi编写Shell扩展

    用delphi创建一个外壳扩展(Shell Extension)程序的基本步骤如下: (1) 创建一个 ActiveX Library 工程,命名为“CloudUpload“(2) 创建一个新的自动化 ...

  7. 中文转码器的工作原理_delphi教程

    最近在做Delphi下的简体与繁体转换, 发现Windows2000自带的工具"中文转码器"很好用, 不仅可以转内码(BIG5-->GBK), 还可以将繁体字转为简体字(如: ...

  8. springboot 整合redis redis工具类

    一步 : pom中引入相关依赖 <!-- 引入 redis 依赖 --> <dependency> <groupId>org.springframework.boo ...

  9. 学JS的心路历程 - JS的Class

    没错,你没有看错,虽然前面说JS是原型继承,但在ES6以后新增了class关键字!!! 不过底层实作仍然是以原型继承方式进行,所以基本上算是一个语法糖. 今天我们就来看一下如何使用吧! class 首 ...

  10. tensorflow pip install 安装指定版本的包并指定安装源(速度会快很多)

    pip install tensorflow-gpu==1.3 pip install tensorflow-gpu==1.4 # pip install 命令行pip install -i http ...