How to find only duplicate records from table ?

Answer Posted / sunil kumar gautam

In my code it is consider that duplication is checked on
the basis of empcd field of emp table.

REPORT ZTESTDUP.
types:begin of ty_du,
EMPID type ZEMP_ASHU_SUNIL-EMPID ,
EMPCD type ZEMP_ASHU_SUNIL-EMPCD,
EMPNM type ZEMP_ASHU_SUNIL-EMPNM,


end of ty_du.

Data: IT_du type standard table of ty_du,
Wa_du type ty_du.


select * INTO CORRESPONDING FIELDS OF TABLE IT_DU
from ZEMP_ASHU_SUNIL.

data: i type I.


data:IT_final type table of ty_du,
wa_final type ty_du.

loop at IT_DU into WA_DU.
i = 0.

loop at IT_DU into WA_DU where empcd = WA_DU-
empcd.

i = i + 1.

endloop.
if i = 2.
wa_final-empid = WA_DU-empid.
wa_final-empcd = WA_DU-empcd.
wa_final-empnm = WA_DU-empnm.
append wa_final to it_final.
clear wa_final.

endif.


endloop.

In above code final internal table contains duplictae data.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Select up to 1 row and select single difference ?

636


Can we make use of flow logic control key words in abap/4 and vice-versa?

585


when run my program in se38 it was showing output, when i take background execution and giving printer details it was shoing out put. but in SP01 when i give the Spool Request Number it was showing not yet processed entire page why it happens i dont know please give me a solution.

2070


How do you send files to the legacy systems from sap and vice versa? How does one know that the legacy files have come on to the sap server you are working on? : abap bdc

558


Work most on which module: name a few tables?

591






What are the update types possible? : abap data dictionary

552


Explain what is a foreign key relationship? Explain this with the help of an example.

558


What is going life actually? What is the role of a functional consultant in it? : sap abap hr

544


Explain what is sap script? What is the purpose of sap script?

622


Can you give the Example for the structure of an ABAP program? REPORT... NODES: SPFLI, SFLIGHT. DATA:... INITIALIZATION. AT SELECTION-SCREEN. START-OF-SELECTION. GET SPFLI... GET SFLIGHT... GET SPFLI LATE. END-OF-SELECTION. FORM... ENDFORM.

599


What is the different between template and a table?

600


What are the disadvantages of logical databases?

659


What will happen when we use single buffered selected?

616


What are field symbols and field groups? Have you used component idx of structure clause with field groups?

600


What is difference between dialog program and a report?

587