Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Difference between two select queries.

Former Member
0 Likes
484

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
460

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.

3 REPLIES 3
Read only

former_member188827
Active Contributor
0 Likes
460

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.

Read only

Former Member
0 Likes
461

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.

Read only

Former Member
0 Likes
460

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.