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

How to Delete a table field dynamically through a program...???

Former Member
0 Likes
700

Hello all,

I am required to delete a desired field from a table dyanmically through a program.

dynamically it has to delete content of that field and then it should dynamically delete that field from that table

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
648

Hi,

for deletion of field you can do some thing like this..

data: wa type dd03l.
data: field like dd03l-fieldname,
      itab like ztest_sav occurs 0 with header line.
      wa_tab like ztest_table.
select single * from ZTEST_TABLE into wa_tab where FIELD = 'TEST'.
clear wa_tab-field.
modify ZTEST_TABLE FROM WA.
if sy-subrc = 0.
commit work.
endif.
      select single * from dd03l
               into wa 
           where tabname = 'ZTEST_TABLE'
           and fieldname = 'FIELD'.

DELETE  DD03L  FROM wa.  "deletion fo field
if sy-subrc = 0.
COMMIT WORK.
endif.

i don't think this is the Proper way to delete the field from table.

But check it.

Regards

vijay

3 REPLIES 3
Read only

Former Member
0 Likes
649

Hi,

for deletion of field you can do some thing like this..

data: wa type dd03l.
data: field like dd03l-fieldname,
      itab like ztest_sav occurs 0 with header line.
      wa_tab like ztest_table.
select single * from ZTEST_TABLE into wa_tab where FIELD = 'TEST'.
clear wa_tab-field.
modify ZTEST_TABLE FROM WA.
if sy-subrc = 0.
commit work.
endif.
      select single * from dd03l
               into wa 
           where tabname = 'ZTEST_TABLE'
           and fieldname = 'FIELD'.

DELETE  DD03L  FROM wa.  "deletion fo field
if sy-subrc = 0.
COMMIT WORK.
endif.

i don't think this is the Proper way to delete the field from table.

But check it.

Regards

vijay

Read only

0 Likes
648

Vijay,

is it requried to delete only from dd30l ...? coz if you look in to dd03m view table we have 3 table...!is it not requierd to delete from those tables also???

Read only

0 Likes
648

Try this FM:

DB_ALTER_TABLE

Regards,

ravi