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: 

Deleting a row!!!!

Former Member
0 Kudos

Hi gurus,

I have a condition where I need to delete the first row of my input file, the only problem is thta I have to take care if there is heading column in the input file then only it should be deleted, otherwise if there is data and no column heading then the row should not be deleted. Can you please suggest me how to proceed. my input file's name is itab.

Thanks

Rajeev Gupta

3 REPLIES 3

Former Member
0 Kudos

You can write simple logic :

When you get the data from File to internal table

Loop at itab.

if sy-tabix = 1. " This check is First record of internal table

if itab-field+0(3) = ' '. " Enter file header data like first 3 charcters

delete itab

clear itab.

endif.

else.

exit.

endif.

endloop.

Thanks

Seshu

Former Member
0 Kudos

hi,

Try this..

LOOP AT ITAB.

  • Check if it is the first row.

IF sy-tabix = 1.

  • Check if the heading is populated, then delete that row..

IF NOT ITAB IS INITIAL.

DELETE ITAB INDEX sy-tabix.

ENDIF.

ENDIF.

ENDLOOP.

Thanks

Naren

Former Member
0 Kudos

DELETE itab INDEX 1.

LOOP AT itab.

IF NOT itab-header IS INITIAL.

DELETE itab.

ENDIF.

ENDLOOP.