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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Rename a Database Table without loosing its data.

Former Member
0 Kudos

Hi All,

I want to rename a database table without loosing its data content.

I have searched a coulpe of blgs and could not find any thing helpful.

I have gone thru this page,

Adjusting Database Structures - Database Utility - SAP Library

and then thought there must be some way, if you read point 3,

  • By converting the table (see

Conversion Process). The database table is renamed and serves as a temporary buffer for the data. The revised version of the table is activated in the ABAP Dictionary and created in the database. The data is reloaded from the temporary buffer to the new database table (with MOVE-CORRESPONDING) and the indexes on the table are built.

I am not sure, how to achieve this.

Will be great, if some one can kindly guide me..!!

Thanking You All..!!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ankit

There is copy option in SE11 ,so that you can copy the table to another table,but i am not sure whether the contents will copy or not.

If contents not copied ,do small report program select all entries from old table and move to renamed table and delete old table

for ex :

select * from mara into lt_mara.

Loop at lt_mara to ls_mara.

move correcpondin ls_mara to ls_new_table.

append ls_new_table to lt_new_table.

endloop.

Thanks

Vamsi

5 REPLIES 5

Former Member
0 Kudos

Hi Ankit

There is copy option in SE11 ,so that you can copy the table to another table,but i am not sure whether the contents will copy or not.

If contents not copied ,do small report program select all entries from old table and move to renamed table and delete old table

for ex :

select * from mara into lt_mara.

Loop at lt_mara to ls_mara.

move correcpondin ls_mara to ls_new_table.

append ls_new_table to lt_new_table.

endloop.

Thanks

Vamsi

0 Kudos

Hi Mohan,

Thanks a lot for the quick reply.

I am much worried about data only, need some input for data.

I do not want to create any program for coping data.

Thanking You All..!!

0 Kudos

Hi Ankit,

It is not possible as you are changing name. Database utility SE14 will work only with same table.

May be you can search enhancement for copy option in SE11 where you can put code to copy data.

Regards,

Sid

Former Member
0 Kudos

Hi,

Sid is right, you cannot rename the table and contain the table contents with SE14. You need to find a workaround, so copy the data to a temporary table and then insert it to your renamed table.

Br,

Tim

0 Kudos

Hi Tim,

Thank a lot for the reply.

I too think that you and Siddarth are correct, but just wanted to collect expert opinion..!!

Thanking You All..!!