09-06-2008 9:27 AM
Hi All,
Does any one know ,How to Delete a Column in Internal Table?
09-06-2008 9:33 AM
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.
09-06-2008 9:30 AM
hi,
Use the following statement.
delete table itab index sy-tabix.
09-06-2008 9:33 AM
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.
09-06-2008 9:38 AM
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
09-06-2008 9:43 AM
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
09-06-2008 9:49 AM
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.
09-06-2008 9:58 AM
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.
09-08-2008 5:30 AM
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.
07-07-2023 6:10 AM
07-07-2023 7:28 AM
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.