2006 Oct 31 10:23 AM
hi all,
CAn we use append statement soon after using collect statement , bcoz i heard tht it reduced performance.Is it true??Plz clarify
regards,
Ganesh
hi all,
CAn we use append statement soon after using collect statement , bcoz i heard tht it reduced performance.Is it true??Plz clarify
regards,
Ganesh
2006 Oct 31 10:28 AM
When you write a 'COLLECT' statement it automatically APPENDS the record.
Regards,
Hema
2006 Oct 31 10:29 AM
There is nothing like that.
BUt you need to append that only if you want a separate internal table with subtptal/totals.
Correct way1
loop at itab.
at end of field1.
collect itab into itab2.
append itab2.
clear itab2.
endat.
endloop.
Correct way2
loop at itab.
at end of field1.
collect itab.
endat.
endloop.
Wrong way.
loop at itab.
at end of field1.
collect itab.
append itab.
endat.
endloop.
Regards,
ravi
2006 Oct 31 10:31 AM
Hi ganesh,
1. When we use collect, we do not use append, for the same internal table.
2. Collect is a special keyword,
which instead of blindly appending the record,
does some extra intelligent logic.
3. When using collect,
it will first COMPARE all the NON-NUMERIC fields,
from the workarea with the full internal table,
- If no matching is found, then only it will apppend the record.
-- if matching is found, then
it will MODIFY the old record,
and SUM UP / ADD the Numeric values.
regards,
amit m.
2006 Oct 31 10:35 AM
COLLECT statement has the same effect as inserting the new line so u not need to write append again. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
You should only use the COLLECT statement if you want to create summarized tables. If you use other statements to insert table entries, you may end up with duplicate entries.
GO THROUGH THIS LINK
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |