on 09-15-2014 9:19 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is the purpose of this exercise ?
Droping the CLIENT ?
What is the table name ?
See program ADBC_DEMO.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leong
You can use function module DDIF_TABL_PUT for the same. Please read the documentation for the same
Nabheet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.