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

Duplicate records

Former Member
0 Likes
667

Hi,

I have developed a ALV report which is working fine, if i give single value as input for a particular field in the selection. But if i give multiple values for the same fields as input, the records are getting duplicated for one input value.

For example, if i give just one PERNR in the input, it will show 6 records as output which are correct. But if i give two pernrs in the input, for one pernr it showing 12 (getting duplicates of original 6) and for other pernr it showing only one which is correct...where might i go wrong..pls suggest me...

Thanks,

Ram.

5 REPLIES 5
Read only

Former Member
0 Likes
626

Hi,

Clear the final internal table which shown in the ALV...

for clear the internal table use Refresh itab statement.

Regards,

SB

Read only

Former Member
0 Likes
626

Hi Ram,

Its just simple, if u try to again execute it will give 18 ,24 entries and so on,

you need to clear the internal table to avoid duplicates.

Read only

Former Member
0 Likes
626

Use the following :


Clear itab.
Delete adjecent duplicates from itab.
DELETE ADJACENT DUPLICATES FROM itab comparing pernr.

Regards,

Rock.

Read only

Former Member
0 Likes
626

Hi, before assign your final internal table to ALV funtion module. just refresh the internal table.

Regards,

Venkat n

Read only

Former Member
0 Likes
626

Hi,

When there is issue of duplicate records the first thing we need to check , if the internal table for ALV is refreshed or not.

Like all data objects, you can initialize internal tables with the

CLEAR <itab>.

.

This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table. If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you

must place two brackets ([ ]) after the table name.

CLEAR <itab>[].

To ensure that the table itself has been initialized, you can use the

REFRESH <itab>.

.

This always applies to the body of the table.

Other thing we can do is use ''delete adjacent duplicates'' syntax.

Hope this will solve your problem.

Plz reward if useful.

Thanks,

Dhanashri.