‎2007 Sep 05 12:42 AM
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.
Thanks
Rajeev gupta
‎2007 Sep 05 1:25 AM
‎2007 Sep 05 3:08 AM
Hi,
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 '.
else.
write: 'fail to copy'.
endif.
Hope that it will be helpful for you
‎2007 Sep 05 3:15 AM
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.
start-of-selection.
get the data from table
select * from ztest99 into table i_ztest.
if sy-subrc ne 0.
message e000(z01).
endif.
loop at i_ztest into wa_ztest.
write:/ wa_ztest. " use fields
clear : wa_ztest.
endloop.
use internal table with out header line for better performance and also use work area.
Thanks
Seshu