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: 

How to Delete a Column in Internal Table

Former Member
0 Kudos

Hi All,

Does any one know ,How to Delete a Column in Internal Table?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

For deleting the column in the internal table, you have to eliminate the field which you want to delete.

loop at itab into wa.

move corresponding wa to wa1.

append wa1 to itab1.

clear wa1.

clear wa.

endloop.

wa1 is the workarea without the field which you want to delete.

itab1 is the internal table which consists of the deleted column.

9 REPLIES 9

Former Member
0 Kudos

hi,

Use the following statement.

delete table itab index sy-tabix.

Former Member
0 Kudos

Hi,

For deleting the column in the internal table, you have to eliminate the field which you want to delete.

loop at itab into wa.

move corresponding wa to wa1.

append wa1 to itab1.

clear wa1.

clear wa.

endloop.

wa1 is the workarea without the field which you want to delete.

itab1 is the internal table which consists of the deleted column.

former_member585060
Active Contributor
0 Kudos

Use Modify statement

Ex:-

Loop at itab into wa_itab.

If condition.

MODIFY Table Itab from wa_itab TRANSPORTING field1.

endif.

Endloop.

Regards

Bala Krishna

Edited by: Bala Krishna on Sep 6, 2008 2:08 PM

Former Member
0 Kudos

Thanks for Answering my Question...

Actually i need to delete a column in the middle of internal table

i have 20 columns in my internal table. I need to delete 10th column from internal table

0 Kudos

if you are doing some Dynamic programming then you can define the internal table dynamically. I don't think you can delete the column in the Run time.

Instead of Delete the column, you can define the Internal table Dynamically in the runtime with columns you want. that is simplest possible way.

0 Kudos

Create another Internal table without the 10 th column and use,

MOVE-CORRESPONDING.

it_itab1 without 10th column

MOVE-CORRESPONDING it_itab TO it_itab1.

REFRESH it_itab. " If you not need the 10th column data.

Former Member
0 Kudos

Use the below bolck of code :-

LOOP AT ITAB INTO WA

MOVE CORRESPONDING WA TO WA1.

APPEND WA1 TO ITAB1.

CLEAR WA1.

CLEAR WA.

ENDLOOP.

Before using this code block you have to eliminate the field which you want to delete because it is mendatory to delete the column in the internal table .

THE Workarea which you want to delete without the field is WA1.And the internal table which consists of the deleted column is=ITAB1.

viva_kd
Explorer
0 Kudos

Did anybody got solution, please update , m looking for same

matt
Active Contributor

See the comment made to an answer above by Bala Krishna on Sep 06, 2008 at 08:58 A

But you should post a new question rather than hijacking a very old one.