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: 
Read only

delete empty rows from itab after split

0 Likes
3,269

hi all,

i do the following:

i have concatenated a bunch of fields into s1 separated by "#".

then i split it at "#" into itab.

now, in some of the itabs i have values that can be like

"Max Müller Str." and this is what i do now:

i do split itab into itab2 at space.

So i have kind of nested loop and my question is, how could i have that more efficient or faster done ?

is there a way of removing empty lines from itab ?

points will surely be awarded, thank you!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,227

Hi!

DELETE itab WHERE field = ''.

or

DELETE itab WHERE field = SPACE.

Regards

Tamá

4 REPLIES 4
Read only

Former Member
0 Likes
1,228

Hi!

DELETE itab WHERE field = ''.

or

DELETE itab WHERE field = SPACE.

Regards

Tamá

Read only

0 Likes
1,227

Hi Tamas,

i tried that, but ( what i forgot to mention is ) that this itab and itab2 are string - itabs, i defined them as

itab LIKE STANDARD TABLE OF s1 WITH HEADER LINE,

itab2 LIKE STANDARD TABLE OF s1 WITH HEADER LINE.

how can i then access them ?

Read only

0 Likes
1,227

Hi,

If u are declaring itabs with header lines then Try this codes:


loop at itab.

if itab-fieldname eq space.
delete itab.
endif.

endloop.

"OR simple use following command
DELETE ITAB WHERE FIELDNAME IS INITIAL.

This statement will delete all occureances of itab where fieldname is empty.

Jogdand M B

Read only

Former Member
0 Likes
1,227

Hi Clemens,

If what you want is to remove empty lines from an itab, you can read previous replies (DELETE ... WHERE f IS INITIAL).

But I understand that your empty lines will look like this:

#########

Being as much "#" as fields you have for each line. So, if the amount of fields is constant, you can compare S1 against "#########" and voilá, you have your empty lines without splitting anything.

Good luck!

Fernando