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 from an internal table

Former Member
0 Kudos
3,400

Hi Experts,

I have an internal table which contains ten fields.

After few processing i want to delete few columns from the internal table which contains the data.

How can i do that?

Please reply it ASAP.

Thanks in advance

1 ACCEPTED SOLUTION

rahulkavuri
Active Contributor
0 Kudos
779

hi

You cannot delete the columns.. declare another internal table with the final structure you want say ITAB2.

LOOP AT ITAB.

MOVE CORRESPONDING FIELDS OF ITAB TO ITAB2.
APPEND ITAB2.

ENDLOOP.

3 REPLIES 3

Former Member
0 Kudos
779

Well, you can NOT delete a column of an internal table, all you can do is to delete the data in that column.


loop at itab into wa.
  wa-desired_column = space.
  modify itab from wa.
endloop.

rahulkavuri
Active Contributor
0 Kudos
780

hi

You cannot delete the columns.. declare another internal table with the final structure you want say ITAB2.

LOOP AT ITAB.

MOVE CORRESPONDING FIELDS OF ITAB TO ITAB2.
APPEND ITAB2.

ENDLOOP.

dhruv_shah3
Active Contributor
0 Kudos
779

Hi,



loop at itab1.
read table itab2 with key field2 = itab1-field1.
if sy-subrc = 0.
delete itab1 index sy-tabix.
endif.
endloop.


HTH

Regards,

Dhruv Shah