How to find only duplicate records from table ?

Answers were Sorted based on User's Feedback



How to find only duplicate records from table ?..

Answer / balaji

Sort the table by key, then

loop and read the key. if it counts more than once thats a
duplicate record.

Is This Answer Correct ?    27 Yes 6 No

How to find only duplicate records from table ?..

Answer / kiss_shore

Hai Bhavana, Just watch out the quesn carefully... It's not
the matter of deleting the duplicate records... Just take
it Easy..

Nanna Bangaram it's not good to comment on others... Just
make sure that they are wrong.. Please intimate them by
requesting.... Not by........

Is This Answer Correct ?    7 Yes 1 No

How to find only duplicate records from table ?..

Answer / siva

amma bangaram bhavan if u posted the answres like this i
affirm that all abap guys will may forget abap on one bad
day .

hy first find the question carefully what that gfy asked is
how to find not to deleate the duplicate records for
table . am i right .
sivasayini@yahoo.com

Is This Answer Correct ?    3 Yes 1 No

How to find only duplicate records from table ?..

Answer / 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

How to find only duplicate records from table ?..

Answer / kkr

*****Keep duplicate records and delete unique records.********
TYPES:BEGIN OF TY_IT,
FIELD1 TYPE C,
FIELD2 TYPE C,
END OF TY_IT.
DATA:IT TYPE STANDARD TABLE OF TY_IT.
DATA:IT1 TYPE STANDARD TABLE OF TY_IT.
DATA:WA like line of IT.
DATA:WA1 like line of IT.
DATA:COUNT TYPE I.

*WA-FIELD1 = 'A'.WA-FIELD2 = 'b'.APPEND WA TO IT.
*WA-FIELD1 = 'A'.WA-FIELD2 = 'b'.APPEND WA TO IT.
*WA-FIELD1 = 'C'.WA-FIELD2 = 'b'.APPEND WA TO IT.
*WA-FIELD1 = 'P'.WA-FIELD2 = 'x'.APPEND WA TO IT.
*WA-FIELD1 = 'D'.WA-FIELD2 = 'b'.APPEND WA TO IT."Delete
*WA-FIELD1 = 'C'.WA-FIELD2 = 'b'.APPEND WA TO IT.
*WA-FIELD1 = 'B'.WA-FIELD2 = 'b'.APPEND WA TO IT."Delete
*WA-FIELD1 = 'P'.WA-FIELD2 = 'x'.APPEND WA TO IT.

SORT IT ASCENDING.

APPEND LINES OF IT[] TO IT1[].

WRITE:/'Before deleting Unique records'.
WRITE:/'------------------------------'.

LOOP AT IT[] INTO WA.
WRITE:/ WA-FIELD1,WA-FIELD2.
ENDLOOP.

DELETE ADJACENT DUPLICATES FROM IT1[] COMPARING ALL FIELDS.

LOOP AT IT1[] INTO WA1.
CLEAR COUNT.
LOOP AT IT[] INTO WA WHERE FIELD1 EQ WA1-FIELD1 AND FIELD2 EQ WA1-FIELD2. "Fields to compare uniqueness
ADD 1 TO COUNT.
CHECK COUNT EQ 2.
EXIT.
ENDLOOP.
CHECK COUNT EQ 1.
DELETE IT[] WHERE FIELD1 EQ WA1-FIELD1 AND FIELD2 EQ WA-FIELD2.
ENDLOOP.

SKIP 1.
WRITE:/'After deleting Unique records'.
WRITE:/'------------------------------'.
delete adjacent duplicates from it[]. "<---Newly added

LOOP AT IT[] INTO WA.
WRITE:/ WA-FIELD1,WA-FIELD2.
ENDLOOP.

Is This Answer Correct ?    2 Yes 1 No

How to find only duplicate records from table ?..

Answer / abaprajaram

Sort the internal table and then find the counter

Is This Answer Correct ?    0 Yes 0 No

How to find only duplicate records from table ?..

Answer / rahul

Hi Balaji,

can u please provide the sample code to explain how to write the read statement and count to get the dublicate entries.

Is This Answer Correct ?    0 Yes 0 No

How to find only duplicate records from table ?..

Answer / bhavna

By using following syntax delete the duplicate records from
table

delete adjacent duplicate entries from table comparing
all fields.

Is This Answer Correct ?    10 Yes 18 No

Post New Answer

More SAP ABAP Interview Questions

How to split one Invoice into Multiple ( Step by Step)?

0 Answers   IBM,


What is difference between dependent and independent data?

0 Answers  


What type of reports (ALV, Interactive, Classic) we can generate in SAP ABAP?

1 Answers  


difference between bapi and lsmw

5 Answers   IBM,


WHAT ARE THE MANDATORY FIELDS TO BE FILLED FROM TABLES BAPIITEMIN, BAPIPARTNR, BAPIITEMEX, BAPICUCFG, BAPICUINS, BAPICUPRT, AND BAPICUVAL IN BAPI 'BAPI_QUOTATION_CREATEFROMDATA

0 Answers   SGT, Steria,






can anyone told me name of abap interview question book with autor name?

7 Answers  


what is search helps..How many types are there?

3 Answers   Cap Gemini,


how to navigate to report from report? note: no transaction code created to report.

1 Answers   IBM,


WHAT IS THE DIFFERENCE BETWEEN FILE PORT AND TRFC PORT ?

2 Answers  


6. what are the differences between scripts & smart forms?

2 Answers  


In the performance standards we have SE30 for Run time analysis where it will show the system count,abap count,data base count if it is more than means then what we will do let us take my abap count will be some 30% and data base will be 60% and system count 50% now what i want to do

2 Answers   HCL,


How can u create a new page in scripts?

3 Answers   Intelligroup,


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2716)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (911)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)