Skip to end of metadata
Go to start of metadata

Applies to:

SAP ECC 6.0 (Release 700, SP 12).


This article explains how to avoid modify and delete statements inside loop...end loop statements using field symbols. 

Author(s):  Rahul Babukuttan

Company:     Applexus Technologies (P) Ltd.
Created on:  11 January 2012
Author(s) Bio

Rahul Babukuttan, Applexus Technologies (P) Ltd.
B.Tech Computer Science Graduate, working as SAP Technology Consultant

Table of Contents


In order to modify/delete records of internal tables we use modify/delete inside loop...end loop statements in ABAP.  This may lead to serious performance issues if the internal table we use is very large. We can simply move these modify/delete statements outside the loop..end loop statements thus optimizing the performance. We can achieve this by the use of field symbols.

How we can achieve this?

For modify:

Step 1: We loop the internal table into field symbol, any assignment to the field symbol will modify the data directly without modify statement. Thus minimizing the use of "MODIFY" statement

For deletion:

Step 1: We need to modify the internal table type by adding one field named deletion indicator at the end of the type declaration.

Step 2: We check for specific condition inside the loop..end loop statement and the deletion indicator is set which satisfies our required condition

Step 3: Outside the loop..end loop, we write the delete statement by adding the condition DELETE itab WHERE deletion indicator eq 'X'.

Case Study

Given below is the abap coding done to delete all records from internal table T_VBAP for all materials which is marked for deletion (LVORM field) in the MARA internal table T_MARA.

//This is a code sample block

In the code above, instead of using a modify statement inside the loop..end loop statement we assign the field symbol <fs_vbap> and make changes to the field of the field symbol which reflects to the values directly.

Note: Instead of putting the delete statement inside the loop..end loop statement, we mark the records which needs to be deleted based on the particular condition and do the deletion outside the loop.

Related Content

Useful Information

Short quick summary to catch the reader's attention and of course the search engine

  • No labels