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

Few Questions...

Former Member
0 Likes
636

Hi all,

i have few queries

> why do we use appending table for ex:

select a b c from bsis into table gt_final where ....

again

select a b c from bsas appending table gt_final where.....

what happens in this scenario.

> is it neccesary to use select endselect in a case statement.

for ex :

CASE gc_yes.

WHEN p_all.

REFRESH gr_bukrs.

WHEN a.

SELECT bukrs FROM t001 INTO gw_t001-bukrs WHERE....

MOVE 'IEQ' TO gr_bukrs1.

MOVE gw_t001-bukrs TO gr_bukrs1-low.

APPEND gr_bukrs1 TO gr_bukrs.

ENDSELECT.

WHEN b.

SELECT bukrs FROM t001 INTO gw_t001-bukrs WHERE ....

MOVE 'IEQ' TO gr_bukrs1.

MOVE gw_t001-bukrs TO gr_bukrs1-low.

APPEND gr_bukrs1 TO gr_bukrs.

ENDSELECT.

ENDCASE.

is it possible to avoid select endselect here..if yes can anyone please let me know how.

Thanks

Zaf

Hi all,

i have few queries

> why do we use appending table for ex:

select a b c from bsis into table gt_final where ....

again

select a b c from bsas appending table gt_final where.....

what happens in this scenario.

> is it neccesary to use select endselect in a case statement.

for ex :

CASE gc_yes.

WHEN p_all.

REFRESH gr_bukrs.

WHEN a.

SELECT bukrs FROM t001 INTO gw_t001-bukrs WHERE....

MOVE 'IEQ' TO gr_bukrs1.

MOVE gw_t001-bukrs TO gr_bukrs1-low.

APPEND gr_bukrs1 TO gr_bukrs.

ENDSELECT.

WHEN b.

SELECT bukrs FROM t001 INTO gw_t001-bukrs WHERE ....

MOVE 'IEQ' TO gr_bukrs1.

MOVE gw_t001-bukrs TO gr_bukrs1-low.

APPEND gr_bukrs1 TO gr_bukrs.

ENDSELECT.

ENDCASE.

is it possible to avoid select endselect here..if yes can anyone please let me know how.

Thanks

Zaf

4 REPLIES 4
Read only

Former Member
0 Likes
612

Hi,

Appending table means we add another data to the table without refreshing it.

Read only

Former Member
0 Likes
612

Hi,

In the first table it will fetch the table entries from database and insert in to internal table.If there are some entries in internal table earlier it will remove all the previous entries and insert new ones.

If you use appending it will append new entries in a internal table which already has some entries.

Endselect usage is not dependent on case statement.

There r two types of select one is Select....

other is select ......Endselect.

<b>Reward if helpful.</b>

Read only

former_member378318
Contributor
0 Likes
612

> why do we use appending table for ex?

We use this when we wish to keep the current contents of the internal table and add new entires at the end of the table. If you did not use this the current contents of the internal table would be replaced by the new result set.

> is it neccesary to use select endselect in a case statement?

Select endselect is not linked to the Case statement in anyway, they are two seperate statements. In your example a case statement is being used to execute different select statements. You could avoid the select end statement by reading the result set into an internal table using SELECT INTO TABLE ... and looping over the internal table to process the results.

Read only

Former Member
0 Likes
612

hi,

1 why do we use appending table for ex:

a: Append is to insert a new record to already existing table.But i hope using of tat particular syntax may reduce the efficiency so its to better to append table separetely rather than using in select.

2 is it neccesary to use select endselect in a case statement.

a: not neccesary, since using select ...endselect may sometimes performance ,u can loop it in separately.

like

CASE gc_yes.

WHEN p_all.

REFRESH gr_bukrs.

WHEN a.

SELECT bukrs FROM t001 INTO gw_t001-bukrs WHERE....

<i>loop gw_t001 .

MOVE gw_t001-bukrs TO gr_bukrs1-low.

APPEND gr_bukrs1 TO gr_bukrs.

endloop.</i>

ENDCASE.