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

Convert a DB-table to structure

oliver_elias90
Discoverer
0 Likes
3,053

Hello together,

I discovered a db-tab in our system which is used only as a structure (in interfaces, table-types,...), but has no content. So i wanted to change it to a structure.

Sadly I found nothing to "convert" it to a structure. This means i will have to delete it and create it again as a structure.

But because it is used so often, i can't simply delete it.

So my question is:

Is there any other way to convert an (empty) db-tab to a ddic-structure than deleting and creating it?

It would be also a possible solution to force to delete it although it is used by other ddic-objects and create it afterwards with the same name.

Thanks in advance,

Oliver

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,818

In SE11 menu, navigate to Extras, Change Table Category, there you could change an empty table to a structure. (Of course any program with an update data statement will get into trouble...)

Regards,

Raymond

Hello together,

I discovered a db-tab in our system which is used only as a structure (in interfaces, table-types,...), but has no content. So i wanted to change it to a structure.

Sadly I found nothing to "convert" it to a structure. This means i will have to delete it and create it again as a structure.

But because it is used so often, i can't simply delete it.

So my question is:

Is there any other way to convert an (empty) db-tab to a ddic-structure than deleting and creating it?

It would be also a possible solution to force to delete it although it is used by other ddic-objects and create it afterwards with the same name.

Thanks in advance,

Oliver

10 REPLIES 10
Read only

naveen_inuganti2
Active Contributor
0 Likes
2,818

What is the problem with that database table?

You cannot always replace a database table with a structure in your code.

Standard tables may not have data unless our business is covered in that sector today, however, you need that for future purpose.

System maintenance will be another BIG thing that you need to consider when we do something with SAP standard objects.

And, list goes on to keep that table in your system

Regards,

Naveen Inuganti

Read only

0 Likes
2,818

Hello Naveen Inuganti,

it seems I need to tell you more details:

1) The table is a customer table. So basically I am able to delete it. But because it is used in programs, interfaces, ... I can't.

2) I have the same table (design) two times in my system. Once used as data storage with content and once used only as a structure type. What I want is converting the db-table which is used as a structure to a structure. So noone is confused by the type of the db-table.

Regards,

Oliver

Read only

0 Likes
2,818

Oliver,

First, you need to delete this table from DD to delete from actual database. I see your problem, it is preventing you to do that by showing where-used-list.

We can build some queries (like custom code maintenance in solution manager) if you should deal with many things like this. But, as this is just for one table, you should go for some manual work.

Especially, if there is any SELECT, FETCH, UPDATE, MODIFY or DELETE queries on this table then edit it manually. I think you just need to comment those lines as you are not going to keep this a table any more.

In fact, you can download list of objects from where used list and complete your task (delete table & create structure with same name). And then, activate (or check) all your where used objects - if there is any error then simply comment that code. I don't see any issue with replacing table with structure in interfaces.

Regards,

Naveen

Read only

DominikKraemer
Active Participant
0 Likes
2,818

I don't think there is an way without changing all the programs where this table is in use.

I would create the structure with a slightly different name than the table and then go ahead and change all the programs to the new structure.

(Be aware that the where-used list does not cover dynamic assignments with field symbol)

Once all are changed you can finally delete the table.

Read only

Former Member
0 Likes
2,818

Do a where used for that DB table and change the existing code according to the structure definition.

And when you delete it delete it using SE14 also , it will carry out the changes in DB as well.

Read only

matt
Active Contributor
0 Likes
2,818

Does it matter? A database table with no content doesn't take up much space.

Read only

0 Likes
2,818

Well the space doesn't matter. But if it is used as a structure, it should be a structure. In addition the table exists two times. Once with and once without data. A new employee might be confused an he/she might use the wrong table. That is why i wanted to declare it correct. But that is done now (see correct answer).

Regards,

Oliver

Read only

matt
Active Contributor
0 Likes
2,818

I entirely agree that structures should be structures and tables, tables. I wasn't aware of the simple solution provided by Raymond .

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,819

In SE11 menu, navigate to Extras, Change Table Category, there you could change an empty table to a structure. (Of course any program with an update data statement will get into trouble...)

Regards,

Raymond

Read only

0 Likes
2,818

Hello Raymond,

thank you! I knew there must be some way without changing the reference in code, interfaces, ....

It was exactly what i looked for. Sure I checked where it is used (by where-used-list and by code scan for dynamic uses).

Regards,

Oliver