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

Create internal table from duplicate entries.

Former Member
0 Likes
527

Hi all,

I have an internal table itab of following format:

Employee No                       Course ID

2001                                          C1

2001                                          C2

2001                                          C3

2002                                          C1

2002                                          C2

2003                                          C2

2003                                          C4

Now I want to select all duplicate records from this table, (comparing emp no) into another internal table, and send mail to that employee telling him that his respective courses against his emp no are pending.

For eg: select emp no 2001 and send a single mail to him suggesting that against him Courses C1, C2 and C3 are pending.

Same follows for other employees.

I need to do this for every employee number. But these emp numbers are altogether in a single internal table.

How can this be achieved?

Please Help! 

Regards,

Pranita

4 REPLIES 4
Read only

Former Member
0 Likes
502

hi,

according to my understanding u have to use the statement DESCRIBE .

by using that we can get count of duplicates then we can loop it and differentiate

my dought how u need to display like this right any other

2001                                          C1

2001                                          C2

2001                                          C3

plz try once and revert me back

Read only

kumud
Active Contributor
0 Likes
502

Hello,

Is the problem that you don't want to send each employee one mail at a time in a loop?

One of the easiest way could be to find the distinct employees first in one internal table and then read the table you have, for each distinct employee to find the courses they have to do and send them a mail. Would the table have huge number of entries? Thanks.

Regards,

Kumud

Read only

Former Member
0 Likes
502

Try to use At new Empno inside loop and use Continue statement to fill the remaining duplicate entries.

loop  .

at new empno.

continue.  use continue to full fill your requirement.

endat.

endloop.

Regards,

Y.Prashaanth.

Read only

Ash_ok
Contributor
0 Likes
502

Hi,

You could use the AT NEW .... ENDAT control level processing - http://help.sap.com/abapdocu_702/en/abenint_table_at_abexa.htm - within an internal table loop to achieve your requirement.

Ashok.