What is the difference between 'extract' and 'collect' statements?
Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
EXTRACT .
When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset.
Each extract record contains exactly those fields that are contained in the field group , plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group , the EXTRACT statement is a shortened form of the statement extracts used in field groups (version 2.x - obsolete these days as noone uses field groups anymore), and collect is used to accumulate the contents of a field if X no. of keys are the same.
EXTRACT HEADER.
When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
Collect:
When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. 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.
Difference between extract and collect statements In SAP ABAP
Topics
-
▼
2008
(35)
-
▼
September
(35)
- SAP ABAP What date format should be used in batch ...
- Easy Way To Remember Table In SAP ABAP
- Difference between extract and collect statements ...
- Trace when a variant of a report was created In SA...
- What is use of using HASHED TABLE In SAP ABAP
- How to get the field descriptions of a table In SA...
- Difference between Work Area and Header Line In SA...
- Working on Polymorphism In SAP ABAP
- Working on Polymorphism1 In SAP ABAP
- How to delete an editor lock In SAP ABAP
- What is the difference between SMOD and CMOD In SA...
- ABAP Self Test Q & A In SAP
- SAP ABAP Interview Questions And Answers
- SAP ABAP Interview Questions And Answers1
- SAP ABAP Real Time Interview Questions And Answers
- Interview Questions And Answers for SAP ABAP
- SAP ABAP Interview Questions And Answers(FAQ's)
- ABAP FAQ in SAP
- ABAP Frequently Asked Question in SAP
- ABAP FAQ in SAP Important
- ABAP Frequently Asked Question FAQ in SAP
- Sample Test Questions on ABAP Programming in SAP
- Real Time questions in SAP ABAP
- QUESTION Database in SAP ABAP
- ABAP Objective Questions in SAP
- Learning ABAP or SAP Application
- Interview Question on BAPI, RFC, ABAP Objects, Tab...
- ABAP Interview Questions in SAP
- Faq Miscellaneous in SAP ABAP
- SAP ABAP FAQ (Technical)
- Important ABAP FAQ's in SAP
- ABAP Certification Sample Questions for Abapers in...
- The Other 50 ABAP Interview Faq's in SAP
- ITs about FAQS in SAP ABAP
- Real Time questions in SAP ABAP
-
▼
September
(35)