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 statement for table with workarea and using INTO workarea

Former Member
0 Likes
10,629

Hi Experts,

I have declared a table with workarea. Whenever i do a 'select single' statement, that workarea gets filled. But, i want to avoid this for one scenario. so, when i use 'select single * from <table> into <wa>', will it fill the external work area and will it not disturb the internal workarea of that table ? as, i require to compare the old and new value of same table in a module pool programming.

Thanks,

Gaurav.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,513

Hi Gaurav,

Assume u have an internal table and a separate work area.

data: it_outtab type table of mara with header line,
 wa_outtab type mara. 

assume the workarea of it_outtab already has some data you require.

If you use the below code, the table's workarea will be filled with new values.

select single * from mara  into it_outtab.

If you use the below code, the table's workarea will contain the old values and new values will be placed in wa_outtab..

select single * from mara  into wa_outtab.

Regards,

Jovito.

3 REPLIES 3
Read only

Former Member
0 Likes
3,513

Hi,

The entries will not be disturbed until you clear them or move some other values into the work area.

Regards,

Srini.

Read only

Former Member
0 Likes
3,514

Hi Gaurav,

Assume u have an internal table and a separate work area.

data: it_outtab type table of mara with header line,
 wa_outtab type mara. 

assume the workarea of it_outtab already has some data you require.

If you use the below code, the table's workarea will be filled with new values.

select single * from mara  into it_outtab.

If you use the below code, the table's workarea will contain the old values and new values will be placed in wa_outtab..

select single * from mara  into wa_outtab.

Regards,

Jovito.

Read only

matt
Active Contributor
0 Likes
3,513

By table with workarea, do you mean a table with a header line? Because tables with headerlines are obsolete, ambiguous and should no longer be used (Exception - some older parts of SAP require them). So you should define your work area seperately, and have an internal table without a header line. Then you won't have confusion over whether the reference is to a table or the workarea.

If your table doesn't have a header line then your question makes no sense to me.

matt