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: 

report

Former Member
0 Kudos

Hi ,

can u pls let me know

DELETE ADJACENT DUPLICATES FROM i_mat.

this should be within the LOOP and Endloop.

6 REPLIES 6

Former Member
0 Kudos

Hi,

NO.

This should be out of Loop.

Just after selecting data into int table use this.

Regards,

Anji

Former Member
0 Kudos

Hi Prakash,

This is not with in the loop but you need to Sort the Internal table before using this Delete Adjacent Statment

Regards

Sudheer

Former Member
0 Kudos

<b>outside the loop.</b>

DATA OFF TYPE I.

DATA: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE C,

END OF LINE.

DATA ITAB LIKE STANDARD TABLE OF LINE

WITH NON-UNIQUE KEY COL2.

LINE-COL1 = 1. LINE-COL2 = 'A'. APPEND LINE TO ITAB.

LINE-COL1 = 1. LINE-COL2 = 'A'. APPEND LINE TO ITAB.

LINE-COL1 = 1. LINE-COL2 = 'B'. APPEND LINE TO ITAB.

LINE-COL1 = 2. LINE-COL2 = 'B'. APPEND LINE TO ITAB.

LINE-COL1 = 3. LINE-COL2 = 'B'. APPEND LINE TO ITAB.

LINE-COL1 = 4. LINE-COL2 = 'B'. APPEND LINE TO ITAB.

LINE-COL1 = 5. LINE-COL2 = 'A'. APPEND LINE TO ITAB.

OFF = 0.

PERFORM LIST.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.

OFF = 14.

PERFORM LIST.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING COL1.

OFF = 28.

PERFORM LIST.

DELETE ADJACENT DUPLICATES FROM ITAB.

OFF = 42.

PERFORM LIST.

FORM LIST.

SKIP TO LINE 3.

LOOP AT ITAB INTO LINE.

WRITE: AT /OFF LINE-COL1, LINE-COL2.

ENDLOOP.

ENDFORM.

Former Member
0 Kudos

Hi Prakash,

Try to use the Delete inside the select and endselect itself while getting the data into the internal table.

Regards,

Mallik.

Former Member
0 Kudos

hi prakash,

u need to write it outside loop....endloop.

example...

if not it_vbrk[] is initial.

delete adjacent duplicates from it_vbrk comparing vbeln.

endif.

regards,

priya.

sivapuram_phanikumar
Active Participant
0 Kudos

Hi Prakash,

It should be before the loop and should have been sorted on the key fields that u r going to use in COMPARING clause.

Regards,

Phani.