How to delete the records in a faster way
The dml is as below:
delete from GFSTM64_PLANT_INVENTORY a
where a.PLANT_EOP_PART_SAKEY IN
(select EOP_PLANT_PART_SAKEY from GFSTM62_EOP_PLANT_PART
where END_OF_PERIOD_DATE = '31-DEC-2011' )
This has to delete 15 lakh records. Taking more than 6 hours and not yet deleted. I do not have the option to change the data model. Please let me know the fastest way to delete the 15 lakh records.
thanks,
Vinodh
Hi,
not having DDL for objects referenced in the statement, table sizes, explain plan and other essential information, we can only guess, but there is a one likely scenario here.
You wrote the DELETE in the form:
DELETE FROM table1 where table1.col1 in (SELECT col1 FROM table2 WHERE <some additional conditions on table2>).
If Oracle 'takes this literally', then it would go through every record in table1 evaluate the IN condition. That means that the query in round brackets will essentially be executed as many times as there are rows in table1!
Fortunately, the optimizer has ways of transforming into a simple join between table1 and table2, which in most cases will be much more efficient. However, in some cases there are may be things preventing the optimizer from doing this query transform (optimizer settings, bugs, use of analytic functions in other parts of the query etc.), so you may try a manual rewrite to help the optimizer, something like:
DELETE FROM table1 where table1.col1 in (SELECT col1 FROM table1, table2 WHERE table1.col1 = table2.col2 and <some additional conditions on table2>)
Best regards,
Nikolay
Similar Messages
-
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
How to delete the record of saved HRA Details...
Hi Experts,
I have put the details of HRA Correctly.But while updating HRA In 0008 Infotype i wrongly updated the wagetype,How should i change the Wagetype.
When i m trying to delete it is showing RECORD CAN NOT BE DELETED (TIME CONSTRAINT 1).
How can delete the record.
Thanking u .
SaiHi
Hope doing well ........ No need to delete any infotype but u can go to PA30 and in change mode their u can delete the wagetype which is wrongly entered
Rajeshk -
How to delete the record in Table
Hi Guru's,
i have Table which contain no.of Records.
i want to deleted one record. if i go to Table maint.Generator....from table itself..
how to do that... when we deleting the record. can we create new TR for that?
can anybody tell me.
Thanks in Advance,
venkatHi,
it is answered, here for my table there is no Table Maint.Generator.
i just explained how i have done it.
i just simply gone into Debug mode. there
code = Dele.
i have given. then i came out from debug mode to Table. there i just got Delete button on application tool bar.
i selected the record then icliked on Delete button.
it is got deleted.
But it is not asking for any new Transport Request.
Regards,
Venkat -
How to delete the record in the file present in the application server?
Hi,
I have two questions.
i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
ii) How can I lock the users whiel one user is accessing the file on the application server?
Thanks in advance.
SuvanHi,
If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
Instead what u can do is Add and field del_flag to ur record structure.
If u want to delete the record from a file just mark this del_flag as 'X'.
While processing u can have a loop like
loop at it_XXX where del_flag <> 'X'.
endloop.
This will logically delete the record.
When u r to finish the application at that time only perform this copying / deleting / and renaing activity
Hope this helps.
Cheers,
Nitin -
HOW to delete the records in CO1P?
Hi all:
When i close the PO,i find the PO have CO1P records.However ,the PO has been settled. Then how can i delete the records in CO1P for this PO.Dear,
CO1P:
Normally the Goods Movement errors are updated in Table AFFW - Goods Movements with Errors from Confirmations and in transaction COGI.
If the table is locked during background using update control for the confirmation then the errors are recorded in CO1P.
COFC:
Used for Reprocessing of errors in confirmation related to actual cost calculations.
Please run CORUPROC Program.
Please check this link also for further help
http://help.sap.com/saphelp_46c/helpdata/en/e3/7cd32396f611d1b5a60000e8359890/frameset.htm
Regards,
R.Brahmankar -
How to delete the records with routine Z_AFRP4_DELETE as note [418584|
Hello Gurus,
I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders
Component version- EHP7 for SAP ERP 6.0
Component-EA-APPL
Release-617
how can I delete these records
Thanks fro Help
AMHello All,
I found the solution, I copied the code in correction instruction number 0000282352 and create the report as programme Z_AFRP4_DELETEand the executed
*$*$----------------------------------------------------------------$*$*
*$ Correction Inst. 0120061532 0000282352 $*
*$--------------------------------------------------------------------$*
*$ Valid for : $*
*$ Software Component SAP_APPL SAP Application $*
*$ Release 40B All Support Package Levels $*
*$ Release 45B All Support Package Levels $*
*$ Release 46B All Support Package Levels $*
*$ Release 46C All Support Package Levels $*
*$ Release 470 All Support Package Levels $*
*$ Release 500 All Support Package Levels $*
*$ Release 600 All Support Package Levels $*
*$ Release 602 All Support Package Levels $*
*$ Release 603 All Support Package Levels $*
*$ Release 604 All Support Package Levels $*
*$ Release 605 All Support Package Levels $*
*$ Release 606 All Support Package Levels $*
*$--------------------------------------------------------------------$*
*$ Changes/Objects Not Contained in Standard SAP System $*
*$*$----------------------------------------------------------------$*$*
*& Object REPS Z_AFRP4_DELETE
*& Object Header PROG Z_AFRP4_DELETE
*& REPORT Z_AFRP4_DELETE
REPORT Z_AFRP4_DELETE .
* This report deletes confirmation records from table AFRP4 that are
* not longer needed. Run it without update flag first !!
tables: afrp4.
data: lt_afrp4 like afrp4 occurs 0,
ls_afrp4 like afrp4.
selection-screen begin of block order with frame.
select-options: zorders for afrp4-aufnr. "order number
selection-screen end of block order.
parameters: update as checkbox.
select * from afrp4 into table lt_afrp4
where aufnr in zorders.
if lt_afrp4[] is initial.
format color col_normal.
write: 'No HR confirmation background records read.'.
exit.
endif.
format color col_heading.
write: /5 'Order', 25 'Confirmation', 45 'Counter'.
skip. uline. skip.
* show corrections
loop at lt_afrp4 into ls_afrp4.
format color col_normal.
write: /5 ls_afrp4-aufnr, 25 ls_afrp4-rueck, 45 ls_afrp4-rmzhl.
endloop.
* update on data base table
if not update is initial.
skip. uline. skip.
delete afrp4 from table lt_afrp4.
if sy-subrc is initial.
format color col_positive.
write: 'HR-records deleted successfull'.
else.
format color col_negative.
write: 'Error when trying to update data base table AFRP4.'.
endif.
endif. -
How to delete a Sparsebundle. A Faster Way.
After many trials and errors, I might have found a way to erase a Sparsebundle faster without having to wipe your entire Time Capsule, or using 3rd party programs.
My Setup: I am using the latest update of OS X Lion up to date. I have a 3 TB Time Capsule to which I back up to, through a Wifi connection.
For this exercise, I connected my device (Laptop) to the Time Capsule through a data cable and not through WiFi - please note that you can also do this through a WiFi connection if you do not have a data cable.
In settings, set your device to never go to sleep in Energy Saver - this is optional - so as not to interrupt the deleting process.
Open a Finder Window, click on your device name under "Devices" in the left column.
Then in the right window, double click on Network.
Then, double click on the hard drive where the Sparsebundle is located that needs to be deleted (click your way through until you reach the window where the Sparsebundle is located - i.e. in my case it was Device Name -> Network -> Time Capsule -> Data -> [this is the spot where my Sparsebundle was located]).
Highlight the Sparsebundle (do not double click on it!).
Click on the little gear button at the top of the window -> then click on "Show Package Contents" in the dropdown box.
After a few moments, files will appear on the right side.
Double click on the "Bands" file and wait for a few seconds/minutes for the bands/files to appear in the new window (there could be as much as 75 000 lines, and more, depending on how long you have been using this Sparsebundle).
Setup to delete Bands:
1. Open up the "Force Quit Applications" window by holding down on "Command" + "Options" and the "Escape" keys simaltaniously, and drag this window to the right side of your screen (for convenience sake).
2. Decrease the size of the main Finder window that contains the bands, and drag it to the left side of the screen.
You are going to use both windows at all times.
Delete Process:
Now, right at the start, relaunch Finder in the "Force Quit Applications" window by highlighting Finder and then click on "Relaunch" at the bottom of the window.
Wait a few moments for the bands to reappear in the Finder window.
Then highlight about 5000 bands at a time and delete them (choosing less will go faster). It might take a while to count the bands and start the deleting process, but be patient.
Then, after the selected lines are deleted, (OR at any time if the process gets stuck for more than a minute), just relaunch Finder again and restart the process.
This is the trick - Relaunch Finder after every batch of bands you delete. (I do not know why, but it works!)
Relaunch Finder -> Delete bands -> Relaunch Finder -> Delete bands -> Relaunch Finder....... etc.
When you are done, do not forget to reset your Energy Saver settings in System Preferences.
By doing this, I was able to delete more than 17 000 bands in 5 minutes as opposed to waiting for 18 hours to delete 31 000 files at a time (in one batch). My original Sparsebundle of 75 000 lines took me almost 48 hours to delete in the old way. With this new way of "Relaunching Finder after every delete" the process was lighting fast in comparisson.I tried this (well, only rm -R without the f or v) and after ten minutes nothing had happened, ie, not asking for confirmation for any files. Even something as simple as a ls command in the bands folder did not produce any results within ten minutes. (I also tried the band method but at best I was able to delete individual bands never more than one, I also tried connecting via SMB and I tried the third-party application Graveyard.)
What was much faster was to simply open up the TC, put the HDD into a HDD dock and delete the bundle with the disk mounted locally. Deletion of 1 TB consisting of almost 100 000 bands took about five minutes with an always active progress bar.
To anybody having a HDD dock (or an easily opened 3.5" HDD enclosure) I recommend this approach. -
How to delete the record in the table without using lead selection?
hi,
I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead selection only.......
help me how to delete without using lead selection.....
DATA:
NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
data itab TYPE TABLE OF zac_modules.
navigate from <CONTEXT> to <MODULE> via lead selection
NODE_MODULE = WD_CONTEXT->GET_CHILD_NODE( NAME = `MODULE` ).
get element via lead selection
ELEM_MODULE = NODE_MODULE->GET_ELEMENT( ).
get all declared attributes
ELEM_MODULE->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = STRU_MODULE ).
NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
IMPORTING
TABLE = itab )
DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id.
CALL METHOD NODE_MODULE->BIND_TABLE
EXPORTING
NEW_ITEMS = itab
SET_INITIAL_ELEMENTS = ABAP_TRUE
INDEX =
ENDMETHOD.Hi ,
The onclick event provides you with a standard paramater "CONTEXT_ELEMENT" which has the element from which the event is triggered.
so you can declare this in the handler(if it is not there) and use it as follows.
CONTEXT_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT an importing paramater.
DATA:
NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
data itab TYPE TABLE OF zac_modules.
CONTEXT_ELEMENT->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = STRU_MODULE ). "Using the context_element paramater to get the static attributes.
NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
IMPORTING
TABLE = itab ) "getting all the data.
DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id. "deleting the particular row from the table and binding it.
CALL METHOD NODE_MODULE->BIND_TABLE
EXPORTING
NEW_ITEMS = itab
* SET_INITIAL_ELEMENTS = ABAP_TRUE
* INDEX =
thanks,
Aditya. -
How to delete the records from custom table???
My requirement is,
I have a custom table, assume as ZABC, I have updated this by my custom program, This data having table can be extracted by BI etract program(Assume ZZZ). Here I am not writing any code for extracting data from table to BI extract program, That they will do by BI extract program. But I want to write the code for
<b>Cleanup of Z tabledelete records 30 days after the BI data extractor has run.</b>
How this is possible suggest me any method having for these???
Thanks SanjuHell Sanjana,
Ask your basis people to do the clean up after 30 days. If you want the clean up only to be done 30 days after BI extract has been done, then u need some sort of indicator to say that BI Extract has been done , like flag and date in a custom table which will be set as soon as extract is done. Then based on that info u need to delete a the records.
Regards -
How to delete the records in BI for deleted reocrds in R/3
Hi ,
We have a scenarion described below...
We have a table in R/3 and updates happen to the table every week with a ZPROGRAM which deletes some of the records and recreates with some logic.
Assuming :
Initially, We did the load to BI and we got 200 records for last week (Initial Load)
After R/3 prgram is ran, it deletes some of the reocrds in those table , say we only have 150.
Now, Can BW somehow know , what are those records and delete those 50 records from the request which has already been loaded ?
FYI, we just have an indicator marked with X on the R/3 table if the program in R/3 has run.
I know, one solution is "selective deletion".
As we have to selectively delete every week, we do not want to take that approach.
Second is "full load" but we do not want to do full load also as the data volume is huge.
We would like to delete those 50 reocrds in BI dynamically with some ABAP code/some logic. Does anyone have any suggestions ???
Regards,
KumarHi Kumar,
I will try to explain it, but at the moment I am unable to take a look at the code.
I have set up a generic function module which will do the trick for more than one specific datasource. This function module is placed in the startroutine and only executed for the first datapackage.
Within the startroutine of the transformation, you have the possibility to use the p_r_request class. This class contains all necessary information about the current DTP load.
I use the get_source and get_target methods to determine the correct database tables dynamically. The t_h_sel (or somthing) contains the current DTP selections. This will include the RequestID and all other selections like fiscal year for example.
Because the write optimized DSO only has a technical key, we can use the RequestID to do the selection on the source table. After that you can compare the source selection with the active table of the second DSO and add all records from the second DSO that are not available in the source selection.
Please note that the key of the second DSO should be the same as the semantic key of the first DSO in order to do the compare.
Best regards and good luck!
Steven Groot -
Hi,
I am having one scenario like,in one database table one field like payment run date is there it is up dated when the payment made.from based on this date we need calculate the no of days to system date.if the days is greater than 125 days i need to be delete that record from db table.could you please provide the logic please.
Thanks.
harinathhi Hari,
do this way..
loop at itab.
lv_tabix = sy-tabix.
if itab-field1 GT '125'.
delete <table> index lv_tabix.
else.
< Do Something>
endif.
endloop. -
I am wondering how to delete the recording demo on my ichat...
I have downloaded the recording demo for ichat and my free trial is up and i don't want to buy it but i do want to delete it is this possible?
Also when the Un-installer is done also delete com.apple.ichat.plist and restart iChat to remove any references in this .plist
It is possible to Download again and run the Uninstaller from the new .dmg if you did not keep it
11:01 PM Tuesday; May 1, 2007 -
How to delete the records from database table without using work area
Hi all,
The purpose of the down program is to delete the entire contents from all the tables. The deletion of the table should be in sorted manner. Is there any other way to write the code more efficiently,
TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
DELETE ZFFMCTL_AP.
IF SY-SUBRC = 0.
DELETE ZFFMMHDR_AP.
IF SY-SUBRC = 0.
DELETE ZFFM_CHANGE_LOG.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_AR.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_AR.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_JV.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_JV.
IF SY-SUBRC = 0.
DELETE ZFFMDTL_SKF.
IF SY-SUBRC = 0.
DELETE ZFFMHDR_SKF.
IF SY-SUBRC = 0.
DELETE ZFINVOICE_DETAIL.
IF SY-SUBRC = 0.
DELETE ZFFMMASTER.
IF SY-SUBRC = 0.
DELETE ZFFMLOGREAD_CLUS.
IF SY-SUBRC = 0.
DELETE ZFFMCTL.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
Waiting for response,
Thanks in advance
JohnWrite this way....
TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR, ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL, ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
DELETE ZFFMCTL_AP.
CHECK SY_SUBRC = 0.
DELETE ZFFMMHDR_AP.
CHECK SY_SUBRC = 0.
DELETE ZFFM_CHANGE_LOG.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_AR.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_AR.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_JV.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_JV.
CHECK SY_SUBRC = 0.
DELETE ZFFMDTL_SKF.
CHECK SY_SUBRC = 0.
DELETE ZFFMHDR_SKF.
CHECK SY_SUBRC = 0.
DELETE ZFINVOICE_DETAIL.
CHECK SY_SUBRC = 0.
DELETE ZFFMMASTER.
CHECK SY_SUBRC = 0.
DELETE ZFFMLOGREAD_CLUS.
CHECK SY_SUBRC = 0.
DELETE ZFFMCTL. -
How to delete the recorded file in imovie(ipad version)
I am try a lot of way to delete it but still can't do it. T____T
Here is a manual that may help:
http://help.apple.com/imovie/ipad/1.4/index.html
Maybe you are looking for
-
UCMDB Excel import - update/delete relationship
Hi, is any solution to update or delete a relationship between the object in Excel import? I created one (excel import), but there are wrong way in the relationship, so I want to change/update or delete all wrong, and create the good . Anyone have an
-
Moving all jar files from our applcation to applib folder on server
Hi, In our project we have three web applications bundled into a EAR file,to reduce the upload size we had a plan of moving all the jar files from WEB-INF/lib to the applib folder in the standalone server, but after moving i tried to run the applicat
-
API call for Sequence vs DLL in report options
I've got my code to automatically use a text file no matter the selection of the Report Format. But what I've found is that if DLL is selected, there are certain parts of my code that do not run versus when the Sequence is selected under "Select a R
-
Can I retrieve my documents?
I have two iPads on one account, I deleted three documents from one of them and they have disappeared from both and aren't in iCloud either, can I retrieve them?
-
Disappearing (non system) icons in dock
every now and then non-mac icon will disappear and get replaced by a ?