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

Logic Required

Former Member
0 Likes
610

Hi Guys,

My internal table data is in such way

first row : a b c d

second : a b c d e

here you can see the first and second row data is same except 5th column so now i want to delete first row i need only second row where maximum data is filled.

how can it possible there are pleanty of data in itab in same way.

Amit.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
592

hi,

assuming that one column doesnt have data.

loop at itab.
v_tabix = sy-tabix.
read table itab into wa_itab where f1 = itab-f1
                               f2 = itab-f2
                               f3 = itab-f3
                               f4 = itab-f4.
if sy-subrc = 0.
  v_new_tabix = sy-tabix.
  if itab-f5 is initial.
    delete itab index v_tabix.
  else.
     if wa_itab-f5 is initial.
       delete itab index v_new_tabix.
    endif.
  endif.
endif.

regards,

madhu

5 REPLIES 5
Read only

Former Member
0 Likes
592

hi,

check out with statement delete adjacent duplicates ..


delete adjacent duplicates of itab comparing f1 f2 f3 f4.

Regards,

Santosh

Read only

0 Likes
592

Santosh,

there is 30 fields in itab i gave example of only 5 fields.

and i need only maximum filled line.

Amit.

Read only

Former Member
0 Likes
592

HEY....

use DELETE ADJASCENT DUPLICATES FROM ITAB COMPARING FLD1 FLD2 FLD3 FLD4....

It will solve ur issue...

Reward helpful answers,

Thanks.

Read only

Former Member
0 Likes
593

hi,

assuming that one column doesnt have data.

loop at itab.
v_tabix = sy-tabix.
read table itab into wa_itab where f1 = itab-f1
                               f2 = itab-f2
                               f3 = itab-f3
                               f4 = itab-f4.
if sy-subrc = 0.
  v_new_tabix = sy-tabix.
  if itab-f5 is initial.
    delete itab index v_tabix.
  else.
     if wa_itab-f5 is initial.
       delete itab index v_new_tabix.
    endif.
  endif.
endif.

regards,

madhu

Read only

Former Member
0 Likes
592

TYPES : BEGIN OF ty_itab,

a(10),

b(4),

c(4),

d(6),

e(6),

END OF ty_itab.

DATA : it_itab TYPE TABLE OF ty_itab.

DATA : is_itab TYPE ty_itab.

is_itab-a = 'a'.

is_itab-b = 'b'.

is_itab-c = 'c'.

is_itab-d = 'd'.

append is_itab to it_itab.

is_itab-a = 'a'.

is_itab-b = 'b'.

is_itab-c = 'c'.

is_itab-d = 'd'.

is_itab-e = 'e'.

append is_itab to it_itab.

clear is_itab.

delete adjacent duplicates from it_itab comparing a b c d.