cancel
Showing results for 
Search instead for 
Did you mean: 

How to drop a field/column of table in dictionary

Former Member
0 Kudos

Hi Experts,

Do anyone know standard class or method or any abap code can used to delete/drop a column in a table?

The table is a not internal table and also not ALV table.

EXEC SQL.

            ALTER TABLE source DROP COLUMN CLIENT

ENDEXEC.


I have tried something like but it did not work.


Thanks for help in advance.

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor
0 Kudos

If table is defined in ddic, use DDIF_TABL_PUT as written by Nabheet.

Else look at ADBC class. But if MANDT is part of primary key, you may first have to drop SQL primary key constraint too, then alter table and last rebuilt it without MANDT.

What are you exactly trying to do, in which context ?

Regards,

Raymond

Former Member
0 Kudos

Thanks for your speedy reply.


I just want to create a new table without certain field, the field not necessary is MANDT.

Do you mean that I need to retrieve all the field in table, and drop the table, then delete one of column, and create a new table to replace the original table?

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Why not use SE11 ?

Use the copy and then modify

Regards.

Former Member
0 Kudos

Because many table need to be modified and need to be dynamic.

meaning drop the original table and replace the original with the copy of the table right?

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

So DDIF_TABL_PUT it is.

Personally I did not had the chance to use it.

Regards.

raymond_giuseppi
Active Contributor
0 Kudos

I hope those are customer table or at least copy of table into customer namespace...

Could you try to LOOP AT your table names list and execute DDIF_TABL_GET to get original table description, then remove client MANDT and create a new table (in customer namespace) with DDIF_TABL_PUT, commit work and  DDIF_TABL_ACTIVATE.

Regards,

Raymond

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Dropping the MANDT will make the table cross client is that recommended ?

In mass ?

Regards.

raymond_giuseppi
Active Contributor
0 Kudos

May the poster work in BW, it depends on the delivery class, for Application table (master and transaction data) or Customizing table, that is not a good idea.

Also he answered to my question


What are you exactly trying to do, in which context ?

with a


I just want to create a new table without certain field, the field not necessary is MANDT.

so not always client.

Regards,

Raymond

rosenberg_eitan
Active Contributor
0 Kudos

OK.

If you feel confident I guess I can too

Regards.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Works like a a charm !!!!

The activate I did manualy.

Regards.

Answers (4)

Answers (4)

former_member195402
Active Contributor
0 Kudos

Hi Leong,

client field normally is the 1st key field in most of SAP standard tables and should be 1st key field in all custom tables.

You mustn't drop it from SAP tables and you shouldn't drop it from your custom tables. Tables without a client field are client independent tables with several restrictions especially on production systems.

Dropping a key field is a dangerous action. You have to check, that this field is not used by secondary indexes, table views and more. The table also needs a conversion after that (which may lead to duplicates, if you have identical keys in different clients).

Which table do you want to change and why do you think, that you need to drop the client field?

Regards,

Klaus

Former Member
0 Kudos

This message was moderated.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

What is the purpose of this exercise ?

Droping the CLIENT ?

What is the table name ?

See program ADBC_DEMO.

Regards.

nabheetscn
Active Contributor
0 Kudos

Thanks Eitan & Raymond I was not aware of ADBC..good one

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

See

Regards.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I heard about ADBC from he mention it in passing....

Regards.

nabheetscn
Active Contributor
0 Kudos

Hi Leong

You can use function module DDIF_TABL_PUT for the same. Please read the documentation for the same

Nabheet