2009 Mar 18 12:08 PM
Hi experts
can you help to increase the performance of this code.
say best statements to replace the following code.which will give good performance.
DATA: itab TYPE STANDARD TABLE OF (db table)
WITH HEADER LINE.
DATA: BEGIN OF itab1 OCCURS 0,
field1 LIKE itab-field1,
field2 LIKE itab-field2,
END OF itab1.
LOOP AT itab.
MOVE-CORRESPONDING itab TO itab1.
APPEND itab1.
DELETE itab.
ENDLOOP.
REFRESH itab. CLEAR itab.
Edited by: sailu k on Mar 18, 2009 1:10 PM
2009 Mar 18 12:12 PM
hi,
DATA: itab TYPE STANDARD TABLE OF /psyng/usertcode(db table)
WITH HEADER LINE.
DATA: BEGIN OF itab1 OCCURS 0,
field1 type itab-field1,
field2 type itab-field2,
END OF itab1.
LOOP AT itab.
*****REMOVING THIS******MOVE-CORRESPONDING itab TO itab1.
itab1-field1 = itab-field1.
itab1-field2 = itab-field2.
APPEND itab1.
************Not required*********DELETE itab.
ENDLOOP.
REFRESH itab. CLEAR itab. " Any ways you are clearing and refreshing the itab else
" reverse of it delete in the loop and just clear the header line
Thanks
Sharath
2009 Mar 18 12:11 PM
>DATA: itab TYPE STANDARD TABLE OF /psyng/usertcode(db table)
>WITH HEADER LINE.
Dont use with header line.
>DATA: BEGIN OF itab1 OCCURS 0,
>field1 LIKE itab-field1,
>field2 LIKE itab-field2,
>END OF itab1.
declare structure using types and declare itab1 of type that structure.
Dont use move coreesponding instead use field names like this
loop at itab into wa.
wa1-field1 = wa-field1.
wa1-field2 = wa-field2.
append wa1 to itab1.
clear wa1.
endloop.
кu03B1ятu03B9к
Edited by: kartik tarla on Mar 18, 2009 5:41 PM
2009 Mar 18 12:12 PM
hi,
DATA: itab TYPE STANDARD TABLE OF /psyng/usertcode(db table)
WITH HEADER LINE.
DATA: BEGIN OF itab1 OCCURS 0,
field1 type itab-field1,
field2 type itab-field2,
END OF itab1.
LOOP AT itab.
*****REMOVING THIS******MOVE-CORRESPONDING itab TO itab1.
itab1-field1 = itab-field1.
itab1-field2 = itab-field2.
APPEND itab1.
************Not required*********DELETE itab.
ENDLOOP.
REFRESH itab. CLEAR itab. " Any ways you are clearing and refreshing the itab else
" reverse of it delete in the loop and just clear the header line
Thanks
Sharath
2009 Mar 18 12:13 PM
Hi,
Avoid using MOVE- CORRESPONDING.
u get many results here with that.
2009 Mar 18 12:13 PM
Hi,
You can use the following:
DATA: itab TYPE STANDARD TABLE OF /psyng/usertcode(db table)
WITH HEADER LINE.
DATA: BEGIN OF wa_itab1,
field1 LIKE itab-field1,
field2 LIKE itab-field2,
END OF wa_itab1.
DATA itab1 like table of itab1.
LOOP AT itab.
MOVE-CORRESPONDING itab TO wa_itab1.
APPEND wa_itab1 to itab1.
ENDLOOP.
Clear itab[].
Best Regards,
Suresh
2009 Mar 18 12:13 PM
try using work area.
LOOP AT itab.
MOVE-CORRESPONDING itab TO itab1. " Remove Move corresponding
APPEND itab1.
*DELETE itab. " Comment delete
ENDLOOP.
Refresh Itab.
Clear Itab.
Regards,
Gurpreet
2009 Mar 18 12:15 PM
LOOP AT itab.
itab1-field1 = itab-field1.
itab1-field2 = itab-field2.
APPEND itab1.
DELETE itab.
ENDLOOP.
2009 Mar 18 12:17 PM
i) Move individual fields of internal table instead of MOVE CORRESPONDING.
ii) Use TYPES and declare internal table like :
TYPES : Begin of itype1,
....
...
end of itype1.
data: itab1 type table of itype1.
And make sure you are using proper SELECTs to fill data .
Regards,
Deepthi
Edited by: Deepthi Upadhyaya on Mar 18, 2009 1:18 PM
2009 Mar 18 12:19 PM
Hi,
write the code in following way
types: begin of stru,
field1 type itab-field1,
field2 type itab-field2,
end of struc.
DATA: itab TYPE STANDARD TABLE OF (db table).
field-symbols: <itab> like line of itab.
data: itab1 type table of stru,
wa like line of itab1.
LOOP AT itab assigning <itab>.
wa-field1 = <itab>-field1.
wa-field2 = <itab>-field2.
append wa to itab1.
ENDLOOP.
refresh itab.
Regards,
Peranandam
2009 Mar 18 12:37 PM
Hi,
Why you are using two internal tables for holding 2 fields of information.
directly us can select the 2 fields from the DB-table into your 2nd internal table, any way you are not at all using the 1st internal table for any purpose.
Regards,
Sreeram