07-31-2007 10:59 AM
what is Collect statement? why this is used?
Message was edited by:
ABHIJEET PADWAL
07-31-2007 11:28 AM
Here is a step-by-step guide
1. Log in to a SAP system
2. Go to transaction SE38
3. Type ZZTEST_ABHIJEET
4. Press the button labelled Create (English login, probably other label if you log on in a different language)
5. Type COLLECT
6. Select text COLLECT
7. Press F1.
Don't hesitate to ask again, we are all here to explain how you can read SAP help information...
07-31-2007 11:28 AM
Here is a step-by-step guide
1. Log in to a SAP system
2. Go to transaction SE38
3. Type ZZTEST_ABHIJEET
4. Press the button labelled Create (English login, probably other label if you log on in a different language)
5. Type COLLECT
6. Select text COLLECT
7. Press F1.
Don't hesitate to ask again, we are all here to explain how you can read SAP help information...
07-31-2007 11:49 AM
I do not know in which system the report ZZ_TEST .... is available, definitely not in every system.
The question is answered with the ABAP online help, use 'i' type in collect, please read all details there.
Basicly the collect statement is used to built up a new internal table with a unique key from another table or moire tables. For lines with identical keys the numerical values are summed up in the new table, assume you have a table
A with key1 key2 valuefield1 with lines
a a 1
a b 3
b a 2
b b 5
But then you are sums of the valuefield1 with identical key1 values, the collect give
a 4
b 7
The collect works faster than doing it by yourself. But never change the new table in the same loop where the collect is executed. The table change will destroy the implicit hashed key, which makes the collect then very slow.
Siegfried