Chinaunix首页 | 论坛 | 博客
  • 博客访问: 278451
  • 博文数量: 62
  • 博客积分: 2966
  • 博客等级: 少校
  • 技术积分: 615
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-07 23:16
个人简介

Be a simple man

文章分类

全部博文(62)

文章存档

2012年(6)

2011年(15)

2010年(6)

2009年(3)

2008年(5)

2007年(27)

我的朋友

分类: 项目管理

2011-05-23 13:15:28

Abstract

This page will explain how to code very efficiently for nested unrelated tables. The article describes how to improve the performance of processing huge data amounts.

Problem Description

The most common performance problem that occurs in ABAP programs is because of huge number of records in the internal tables. It becomes a severe performance problem if a program has huge nested internal tables. How much ever efficient data select routines are, data processing routines would be contributing significantly for the bad performance. When analyzed it would be revealed that the where condition that is used in inner loops expend a significant amount of processing time. The idea is to avoid where conditions in the inner loops by maintaining the loop indexes manually.

Conventional Code for nested loops
Conventional Method
loop at lt_vbpa into wa_vbpa. loop at lt_kna1 into wa_kna1 where kunnr = wa_vbpa-kunnr. ****** Your Actual logic within inner loop ****** endloop. endloop.
Code sample: Parallel Cursor method
Preferred Method
sort: lt_vbpa by kunnr, "Sorting by key is very important lt_kna1 by kunnr. "Same key which is used for where condition is used here loop at lt_vbpa into wa_vbpa. read lt_kna1 into wa_kna1 " This sets the sy-tabix with key kunnr = wa_vbpa-kunnr binary search. if sy-subrc = 0. "Does not enter the inner loop v_kna1_index = sy-tabix. loop at lt_kna1 into wa_kna1 from v_kna1_index. "Avoiding Where clause if wa_kna1-kunnr <> wa_vbpa-kunnr. "This checks whether to exit out of loop exit. endif. ****** Your Actual logic within inner loop ****** endloop. "KNA1 Loop endif. endloop. " VBPA Loop
阅读(724) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~