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: 

Delete from internal table based on field length

Former Member
0 Kudos
1,237

Hi Friends,

I have an internal table with 2 columns.

In one column i have entries with 3 different field lengths (18, 21, 24). Now my requirement is to delete the rows with the field length 21 and 24. Or delete the rows with field lenght 18 and 24 Or delete the rows with field length 18 and 21.

How to acheive this?

Your suggestions and ideas will be appreciated.

Thanks & Regards,

Raju

Moderator message - Total Posts: 350 Total Questions: 132 (111 unresolved) If you assign po(i)nts and close your old posts, that will encourage people to respond to your new questions.

Edited by: Rob Burbank on May 20, 2009 11:54 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
427

What about?

delete tab where field1+18 is not initial.

3 REPLIES 3

former_member194669
Active Contributor
0 Kudos
427

Try something like


loop at itab.
v_length = strlen( itab-field1 ) .
if v_length = 24.
   delete itab index sy-tabix.
endif
endloop.

Former Member
0 Kudos
428

What about?

delete tab where field1+18 is not initial.

0 Kudos
427

Thank you both for the responses.

The solutions were helpful to me, however i used the second approach as it doesnt involve the LOOP and definitely has good performance.

Points awarded to both.

Regards,

Raju