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

select query

Former Member
0 Likes
1,118

Hi,

can anyone tell me what this code is doing?

SELECT matnr labst

FROM mard

APPENDING TABLE i_stock

FOR ALL ENTRIES IN i_matdoc

WHERE matnr = i_matdoc-matnr

AND werks = i_matdoc-werks.

why is this appending written?

regards,

Poonam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,095

Hi ,

It is similar to ... INTO TABLE lt_tab, but the difference is that read lines are appended to the previous contents of the internal table lt_tab.

Best regards,

raam

10 REPLIES 10
Read only

Former Member
0 Likes
1,095

hi,

If there is already any data in the internal table it is not refreshed,

this select stmt. will just keep appending the new values to the same internal table.

Regards,

Subramanian

Read only

Former Member
0 Likes
1,095

I very good way to learn about a ABAP is to become familiar with the F1 Function key in the Text Editor when you are unfamilar with a Statement and Syntax. It is much faster than posting a thread here.

Read only

Former Member
0 Likes
1,095

Hi,

The records that are allready there in the Internal table will not be refreshed . The new records from the select statement will be appended to the allready exsisting records .

Read only

Former Member
0 Likes
1,095

hi,

if my internal table has data before select stmt triggers.

once select stmt is executed then the data in the internal table is refreshed and new data is stored as per the select stmt.

to avoid that we use append stmt in select , the purpose the selected values are appended to the existing internal table values.

Rgds

subash

Read only

0 Likes
1,095

hi,

in ABAP edtor on select keyword put cursor and press F1 you will get detail documentation for this.

warm regards,

surendar reddy.

Read only

Former Member
0 Likes
1,095

Hi Poonam,

The select statement is selecting the matnr and labst from mard table and appending them into table i_stock for all those entries in the internal table i_matdoc which are satisfying the condition.

Here instead of into table we are using APPENDING TABLE, which appends the records into the table.

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,095

i_stock might be having entries even before executing to this

select .. In order to retain old values along with the new values

APPENDING is used ...

Read only

Former Member
0 Likes
1,096

Hi ,

It is similar to ... INTO TABLE lt_tab, but the difference is that read lines are appended to the previous contents of the internal table lt_tab.

Best regards,

raam

Read only

Former Member
0 Likes
1,095

thanks.

Read only

Former Member
0 Likes
1,095

if the criteria is to select data from 2 db tables into the 1 internal table and where u cannot use joins this statement is used..