cancel
Showing results for 
Search instead for 
Did you mean: 

which is more efficient in modifying internal table.field symbol or modify

Former Member
0 Kudos

TABLES : BSEG .

DATA:BEGIN OF I_BSEG OCCURS 0.

INCLUDE STRUCTURE BSEG.

DATA : END OF I_BSEG.

FIELD-SYMBOLS:<I_BSEG1> LIKE LINE OF I_BSEG.

SELECT * INTO TABLE I_BSEG FROM BSEG WHERE BELNR = '0100000570'.

LOOP AT I_BSEG ASSIGNING <I_BSEG1> .

<I_BSEG1>-belnr = '4560000000'.

ENDLOOP.

*LOOP AT I_BSEG.

*

*

*I_BSEG-BELNR = '4560000000'.

*

*MODIFY I_BSEG TRANSPORTING BELNR.

*

*ENDLOOP.

*

LOOP AT I_BSEG.

WRITE: / I_BSEG-BELNR.

ENDLOOP.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi,

if Modify is used:

abap - 7.3%

db - 89.4%

system - 3.3%

if field-symbol is used

abap - 7.4%

db - 89.4%

system - 3.2%.

In my opinion modify is more efficient

u can do the run time analysis using t.code se30.

regards.

Former Member
0 Kudos

Hi annie!

the performance totally depends upon the Number of rows in the tables, size of the table, number of attributes in the table.

it will not be same for all the tables. Here the scenario is BSEG which is the biggest tables in SAP.

regards

kishore

hymavathi_oruganti
Active Contributor
0 Kudos

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.

THE ABOVE IS THE DOCUMENTATION AVAILABLE IN TIPS AND TRICKS IN SE30 .

Former Member
0 Kudos

hi harikishore,

You are right that efficiency of field-symbol is greater then modify statement.

regards

former_member186741
Active Contributor
0 Kudos

the field symbol method is more efficient but it will only be noticeable if you have many records in your table. In your particular example perfromance will probaly be identical as there seems to be only one record in the table.

Former Member
0 Kudos

HI Madan.

IN this case the field symbol will be more efficient. The field symbols is the direct pointer to the field in BSEG. so the modification takes faster.

If you do it in other way the transporting statement will take some time becoz BSEG is the biggest table which will affect the performance.

regards

kishore

Former Member
0 Kudos

thanks hyma and hari....

ur answer makes my concept more clearer

Former Member
0 Kudos

HI Madan!

Plz close the thread if your request is solved

regards

kishore

Former Member
0 Kudos

HI madan

As per the forum etiquette. The post must be closed once your problem is solved by rewarding the helpful answers.

regards

kishore

hymavathi_oruganti
Active Contributor
0 Kudos

FIELD-SYMBOL is more efficient than using modify.

loop at itab assigning <fs>.

<fs>-name = 'abc'.

endloop.

in the above <fs> is poiniting to address of itab. so any changes directly reflect. no need to use modify.

loop at itab.

itab-name = 'abc'.

modify itab transporting name.

endloop.

modify statement again searches the whole itab and replaces which increases load

Former Member
0 Kudos

HI Madan,

I hope both these methods are equally effecient..

both took the same runtime to execute..

But,I think field-symbols will be more effective to use..

regards

satesh