‎2008 Oct 21 12:50 PM
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.
‎2008 Oct 21 12:54 PM
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.)
‎2008 Oct 21 12:53 PM
‎2008 Oct 21 12:54 PM
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.)
‎2008 Oct 21 12:56 PM
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
‎2008 Oct 21 1:01 PM
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.
‎2008 Oct 21 1:03 PM
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.
‎2008 Oct 21 12:58 PM
HI,
I think there should not be any issues.
Thanks,
Sriram Ponna.