Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modifying the internal table

Former Member
0 Likes
694

Hi,

i have internal table it_pa0000 and work area wa_pa0000 with below fields. i fetched the data from pa0000 into corresponding fields of table it_pa0000. the field partid is with data type char10.

TYPES:BEGIN OF typ_pa0000,

pernr TYPE persno,

endda TYPE endda,

begda TYPE begda,

massn TYPE massn,

massg TYPE massg,

stat2 TYPE stat2,

partid TYPE char10, ---> not in pa0000 database table

END OF typ_pa0000.

now i want to fill partid(char10) with pernr which is numeric....for that i did loop and use modify statement..is there any alternative with good performance?

LOOP AT it_pa0000 INTO wa_pa0000.

wa_pa0000-partid = wa_pa0000-pernr.

MODIFY TABLE it_pa0000 FROM wa_pa0000 .

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
663

define a field symbol and LOOP into it, than you don't need the MODIFY statement. This will be a bit faster:

LOOP AT it_pa0000 ASSIGNING <wa_pa0000>.
<wa_pa0000-partid> = <wa_pa0000-pernr>.
ENDLOOP.

(I don't think there should be any performance issue with your coding.)

6 REPLIES 6
Read only

Former Member
0 Likes
663

no, your code is quite fine.

Read only

JozsefSzikszai
Active Contributor
0 Likes
664

define a field symbol and LOOP into it, than you don't need the MODIFY statement. This will be a bit faster:

LOOP AT it_pa0000 ASSIGNING <wa_pa0000>.
<wa_pa0000-partid> = <wa_pa0000-pernr>.
ENDLOOP.

(I don't think there should be any performance issue with your coding.)

Read only

0 Likes
663

well Eric, tho i dont think there is any gain performancewise, your solution is way more elegant

/edit typos corrected

Edited by: Florian Kemmer on Oct 21, 2008 1:57 PM

Read only

0 Likes
663

Hi,

Adding to Eric ans.

<wa_pa0000> should be of type same as it_pa0000

FIELD-SYMBOLS: <wa_pa0000> TYPE typ_pa0000.

I hope U can't better performance other than Eric's solution.

Thanks,

Vinod.

Read only

0 Likes
663

Florian:

LOOP ... INTO ... ==> This will make that the line of the internal table is copied to somewhere else

LOOP ... ASSIGNING ==> This will make that the field symbol shows directly to the line of the internal table, i. e. no copy is done, that makes it a little-little-litte-little... faster

But I pointed out in my first reply, that there should not be any perf. issue in the original coding.

Read only

Former Member
0 Likes
663

HI,

I think there should not be any issues.

Thanks,

Sriram Ponna.