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

Select statement

Former Member
0 Kudos

Hi gurus,

I have a scenario where I need to copy everythng from one of my 'z_test' table(custom table) into my internal table it_tab and for this I have written thr following code, I just want to make sure whether I have written it right or not?

select * into table it_tab

from zbs_test.


Rajeev gupta


Developer Advocate
Developer Advocate
0 Kudos

Of course you could have simply tested this, but yes that is the correct syntax as long as IT_TAB is defined as...

data: IT_TAB type table of zbs_test.


Rich Heilman

Former Member
0 Kudos


to make sure that you have wriiten well for the code , you can check it with sy-subrc

If sy-subrc = 0 , this means that you have copied successfilly .

you can define the code as below:

DATA : it_tab TYPE TABLE OF zbs_test.

Select * from zbs_test into table it_tab.

If sy-subrc EQ 0.

Write: ' Copied successfully '.


write: 'fail to copy'.


Hope that it will be helpful for you

Former Member
0 Kudos

Looks like your code is good and i am not sure how are you declaring internal table.

Check the below code and here i am using one custom table (ZTEST99).

report ztest_ytt.

tables : ztest99.

  • internal table

data i_ztest type standard table of ztest99.

  • work area

data wa_ztest like line of i_ztest.


  • get the data from table

select * from ztest99 into table i_ztest.

if sy-subrc ne 0.

message e000(z01).


loop at i_ztest into wa_ztest.

write:/ wa_ztest. " use fields

clear : wa_ztest.


use internal table with out header line for better performance and also use work area.