2007 Dec 06 10:33 AM
hi everybody,
i have some duplicate records in my flat file.
i have 1200 records to upload in to database. in those 1200 records there are many duplicate records.
my problem is i dnt want to upload the reocrds along with dulpicates.
example :
if i had 5 records out of which 4 or duplicate an 1 is orginal record
so i want only original records to be upladed into database.
after the original records are known i will use bdc an upload the those records into database. plz tell me hw to do this with a sample example . an plz provide code for it.
hi everybody,
i have some duplicate records in my flat file.
i have 1200 records to upload in to database. in those 1200 records there are many duplicate records.
my problem is i dnt want to upload the reocrds along with dulpicates.
example :
if i had 5 records out of which 4 or duplicate an 1 is orginal record
so i want only original records to be upladed into database.
after the original records are known i will use bdc an upload the those records into database. plz tell me hw to do this with a sample example . an plz provide code for it.
2007 Dec 06 10:38 AM
Hi,
see this code.
u can delete duplicates from ur records like this.
DATA: BEGIN OF connection,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
distid TYPE spfli-distid,
distance TYPE spfli-distance,
END OF connection.
DATA connection_tab LIKE SORTED TABLE OF connection
WITH NON-UNIQUE KEY cityfrom cityto
distid distance.
SELECT cityfrom cityto distid distance
FROM spfli
INTO TABLE connection_tab.
DELETE ADJACENT DUPLICATES FROM connection_tab.
rgds,
bharat.
2007 Dec 06 10:40 AM
Hi Satish,
you can't delete duplicate records from your flat file.
for this first upload that flat file into your internal table using FM 'GUI_UPLOAD'
and then use 'DELETE ADJACENT DUPLICATES from i_tab COMPARING <fields>'.
regards,
vikas
plz reward if helpful
2007 Dec 06 10:43 AM
take the records in an internal table from flat file.
write the code for that internal table (it_tab1)
delete adjacent duplicates from it_tab1.
now post that data from it_itab1 into BDC.
regards,
Sandeep Kaushik
2007 Dec 06 11:06 AM
Sort itab ascending.
delete adjacent duplicates from itab comparing all fields.
2007 Dec 06 11:06 AM
hi!!!!!!!!!!
To delete adjacent duplicate entries use the following statement:
DELETE ADJACENT DUPLICATE ENTRIES FROM <itab>
[COMPARING <f1> <f 2> ...
|ALL FIELDS].
The system deletes all adjacent duplicate entries from the internal table <itab>. Entries are duplicate if they fulfill one of the following compare criteria:
Without the COMPARING addition, the contents of the key fields of the table must be identical in both lines.
If you use the addition COMPARING <f1> <f 2> ... the contents of the specified fields <f 1 > <f 2 > ... must be identical in both lines. You can also specify a field <f i > dynamically as the contents of a field <n i > in the form (<n i >). If <n i > is empty when the statement is executed, it is ignored. You can restrict the search to partial fields by specifying offset and length.
If you use the addition COMPARING ALL FIELDS the contents of all fields of both lines must be identical.
You can use this statement to delete all duplicate entries from an internal table if the table is sorted by the specified compare criterion.
If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4.
reward if useful..
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |