‎2008 Mar 06 7:57 AM
hello everybody,
can anybody please help me in clarifying the diffrence between two queries mentioned below with examples.Please take the trouble to explain this through examples.
(1)select matnr mtart meins from mara appending table i_mara.
(2)select matnr mtart meins from mara into table i_mara.
ITS EXTREMELY URGENT...
HELP
Edited by: sanjay kumar on Mar 6, 2008 8:58 AM
‎2008 Mar 06 8:00 AM
If i_mara has already populated with some data then the 1st select query add the respect rows at the end of the existing rows. where as second select query will delete the existing rows and will only append the data of the next selection.
ADDITION APPENDING
... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab [PACKAGE SIZE n]
Effect
If the result set consists of multiple lines, an internal table itab of any table type can be specified after INTO or APPENDING. The row type of the internal table must meet the prerequisites.
The result set is inserted into the internal table itab line-by-line; a sorting process is executed in the case of a sorted table. If INTO is used, the internal table is initialized before the first line is inserted. Previous lines remain intact if APPENDING is used.
‎2008 Mar 06 8:00 AM
we use appending additon when internal table already contains data and we want to add data after existing data records.
into table is used when internal table is blank..
If INTO is used, the internal table is initialized before the first line is inserted. Previous lines remain intact if APPENDING is used.
‎2008 Mar 06 8:00 AM
If i_mara has already populated with some data then the 1st select query add the respect rows at the end of the existing rows. where as second select query will delete the existing rows and will only append the data of the next selection.
ADDITION APPENDING
... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab [PACKAGE SIZE n]
Effect
If the result set consists of multiple lines, an internal table itab of any table type can be specified after INTO or APPENDING. The row type of the internal table must meet the prerequisites.
The result set is inserted into the internal table itab line-by-line; a sorting process is executed in the case of a sorted table. If INTO is used, the internal table is initialized before the first line is inserted. Previous lines remain intact if APPENDING is used.
‎2008 Mar 06 9:36 AM
Hi
select matnr mtart meins from mara appending table i_mara.
it will fetch one record from database table and append that record to internal table and again it goes to database to fetch another record.In this way for every record it goes to database
if you use
select matnr mtart meins from mara into table i_mara.
it fetch all records at a time from database table.
the output for the both select statement is same.these are differ in performance level.