Modifying a set of lines directly


Modifying all lines completely

* Entries: 100 (outer table), 20 (inner table)
* The entries to be modified: 50
* Actually, only the component FLAG is updated.
* However, the complete lines are moved.

LOOP AT ITAB INTO WA.
  I = SY-TABIX MOD 2.
  IF I = 0.
    WA-FLAG = 'X'.
    MODIFY ITAB FROM WA.
  ENDIF.
ENDLOOP.

 

 

Modifying selected components only


* Entries: 100 (outer table), 20 (inner table)
* Entries to be modified: 50
* The component FLAG is updated directly.

LOOP AT ITAB ASSIGNING <WA>.
  I = SY-TABIX MOD 2.
  IF I = 0.
    <WA>-FLAG = 'X'.
  ENDIF.
ENDLOOP.

 

Documentation
Accessing the table entries directly in a "LOOP ... ASSIGNING ..."
accelerates the task of updating a set of lines of an internal table
considerably. Especially if inner tables must not be moved the
speed-up is high.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章