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

Internal table -Logic-Data manipulation

Former Member
0 Likes
420

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.

2 REPLIES 2
Read only

Former Member
0 Likes
385

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

Read only

Former Member
0 Likes
385

Hi,

Please be clear with your question. What is the criteria of that Overlapping ?