Skip to Content
0
Jan 04, 2008 at 08:31 AM

ABAP Code not working

284 Views

Hi,

I have made a query and in the query I have created an additional field to find any duplicates in a table. When I check the code there is no error which says to me the code is ok however when I run the query it brings a result of 0 even though there are duplicate production order numbers. What am I doing wrong?

Please see below code if you can change this and let me know i would appreciate this.

Points will be awarded thanks

DATA : BEGIN OF itab OCCURS 0,

aufnr LIKE ekkn-aufnr,

END OF itab.

DATA : count(2) TYPE p.

DATA : no_of_records(3) TYPE p.

Clear no_of_records.

select aufnr from ekkn into itab.

endselect.

SORT itab BY aufnr.

LOOP AT itab.

ADD 1 TO count.

AT END OF aufnr.

IF count GE 2.

ADD count TO no_of_records.

ENDIF.

CLEAR count.

ENDAT.

ENDLOOP.

DUPLICATES = NO_of_records.