‎2008 Aug 21 1:59 AM
Hi,
I have following requirement.
Input Internal table
*A T1 1 3
*A T2 4 5
*A T3 1 2
*B T4 1 2
*B T5 3 6
*B T6 1 7
Output
*A T1 1 3
*A T2 4 5
*B T6 1 7
basically i should delete overlapping records
eg: since A t3 1 2 is overlapping record it should be deleted.
report x.
DATA: BEGIN OF ITAB OCCURS 0,
FLD1 TYPE CHAR20,
FLD2 type char20,
NUM1 TYPE I,
NUM2 TYPE I,
END OF ITAB.
ITAB-FLD1 = 'A'.
ITAB-FLD2 = 'T1'.
ITAB-NUM1 = '1'.
ITAB-NUM2 = '3'.
APPEND ITAB.
ITAB-FLD1 = 'A'.
ITAB-FLD2 = 'T2'.
ITAB-NUM1 = '4'.
ITAB-NUM2 = '5'.
APPEND ITAB.
ITAB-FLD1 = 'A'.
ITAB-FLD2 = 'T3'.
ITAB-NUM1 = '1'.
ITAB-NUM2 = '2'.
APPEND ITAB.
ITAB-FLD1 = 'B'.
ITAB-FLD2 = 'T4'.
ITAB-NUM1 = '1'.
ITAB-NUM2 = '2'.
APPEND ITAB.
ITAB-FLD1 = 'B'.
ITAB-FLD2 = 'T5'.
ITAB-NUM1 = '3'.
ITAB-NUM2 = '6'.
APPEND ITAB.
ITAB-FLD1 = 'B'.
ITAB-FLD2 = 'T6'.
ITAB-NUM1 = '1'.
ITAB-NUM2 = '7'.
APPEND ITAB.
LOOP At ITAB.
ENDLOOP.
‎2008 Aug 21 5:00 AM
Hi Praveen,
You have to SORT the internal table ITAB by a field of your requirement. Then DELETE adjacent entries in the internal table by comparing the field of interest.
SORT ITAB BY NUM1 NUM2.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING NUM1 NUM2.
After doing this you can perform the required actions on ITAB.
Hope this has cleared your doubt.
Thanks & Regards,
Ramya Shree.M.R
‎2008 Aug 21 5:09 AM
Hi,
Please be clear with your question. What is the criteria of that Overlapping ?