Deleting records from table MVER
We are experiencing performance issues when adding data to table MVER. We have data on there that is over 5 years old which could be deleted. As we have not been able to find any standard program or process that carries out housekeeping on MVER we are considering writing an ABAP program to delete the records. Has anyone had any problems when deleting records from MVER or does anyone know of any reason why we should not delete these records in this way ?
Well, I wouldn't delet data from a standard SAP table based on information from the internete. I'd look at other alternatives.
Are you maintaining custom indexes on this table?
Are your database statistics up to date?
Consider a databse re-org.
I don't think simple inserts should cause a problem.
Rob
Similar Messages
-
Delete records from tableA which are not in tableB
Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
delete from tableA where empno not in (select empno from tableb)
or
delete from tableA where empno not exists (select empno from tableb
where b.empno=a.empno)
any helpHi
If you can do this, do with this:
create table tableC
as select a.*
from tableA a,
(select empno from tableA
minus
select empno from tableB) b
where a.empno = b.empno;
drop table tableA;
rename table tableC to tableA;
Ott Karesz
http://www.trendo-kft.hu -
How do you delete records from table with data in a select option
how do you delete records from table with relevant to data in a select option..how to write coding
Hi,
Try
if not s_select_option [ ] is initial.
delete * from table
where field in s_select_option.
endif.
commit work.
Be careful though. If select option is emty, you will delete the entire table.
Regards,
Arek -
How to delete record from table control in BDC?
Hello friends,
I am running a BDC program to delete records.
I have file with following records and i got these records into t_itab.
Material Plant Start date End date Cost
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100004 S002 09/01/2008 09/31/2008 56.00
MQ100008 S003 09/01/2008 09/31/2008 57.00
Now, I have BDC transaction in which table control screen which contains following structure.
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100002 S002 09/01/2008 09/31/2008 56.00
MQ100004 S003 09/01/2008 09/31/2008 47.00
MQ100005 S004 09/01/2008 09/31/2008 25.00
MQ100006 S012 09/01/2008 09/31/2008 76.00
MQ100007 S033 09/01/2008 09/31/2008 17.00
MQ100008 S011 09/01/2008 09/31/2008 95.00
MQ100009 S002 09/01/2008 09/31/2008 46.00
I have recorded from SHDB in which first record will be delete.
So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
Which i don't want to.
Is there any facility in BDC to put records on top which i want to delete?
Please guide me.
Regards,
RHHi,
While doing recording check for Filter button available for the table control, if it available then do the recording for the same.
Once it is done while passing the data from internal table put the value into Filter field.
Hope it resolves your issue.
Thanks & Regards.
Nagaraj Kalbavi -
How to delete record from table control using BDC?
Hello friends,
I am running a BDC program to delete records.
I have file with following records and i got these records into t_itab.
Material Plant Start date End date Cost
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100004 S002 09/01/2008 09/31/2008 56.00
MQ100008 S003 09/01/2008 09/31/2008 57.00
Now, I have BDC transaction in which table control screen which contains following structure.
MQ100001 S001 09/01/2008 09/31/2008 55.00
MQ100002 S002 09/01/2008 09/31/2008 56.00
MQ100004 S003 09/01/2008 09/31/2008 47.00
MQ100005 S004 09/01/2008 09/31/2008 25.00
MQ100006 S012 09/01/2008 09/31/2008 76.00
MQ100007 S033 09/01/2008 09/31/2008 17.00
MQ100008 S011 09/01/2008 09/31/2008 95.00
MQ100009 S002 09/01/2008 09/31/2008 46.00
I have recorded from SHDB in which first record will be delete.
So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
Which i don't want to.
Is there any facility in BDC to put records on top which i want to delete?
Please guide me.
Regards,
RHOne option is to identify the table and find out the location as the number of row which should be deleted from the table and then in the bdc program instead of postioning the cursor on the row 1(using the statement perform bdc_cursor ....(01)), replace the 01 with the row number.
Second option is that if a filter control is available for the table control, then filter the data each and every time with the material number to be deleted and then delete the first row.
Regards
Farzan -
Deleting Records from Referential Tables
Hi,
Can anyone help me in deleting records from tables in a hierarcial manner. For e.g C refers B and B refers A. I need to delete data from all three tables related to a where clause in A.I tried using User_constraints and User_cons_columns views. But i am not able to find a hierarchial delete statement.
VenkateshDid you look into the option of specifying ON DELETE CASCADE for your foreign key constraints. That way, if you delete a
row from the master table Oracle will automatically go and delete the child rows. Take a look at the following script.
Here, when I delete a row from table A for NUM = 1 the child rows from table B (WHERE num = 1) are automatically deleted.
drop table b
drop table a
create table a (num number, name varchar2(40))
create table b (num number, name varchar2(40))
alter table a add constraint pk_a primary key(num)
alter table b add constraint fk_b_num foreign key (num) references a(num) on delete cascade
insert into a values (1, 'Test#1')
insert into a values (2, 'Test#2')
insert into b values (1, 'Referes#1')
insert into b values (2, 'Referes#2')
select * from a
select * from b
delete from a where num = 1
select * from a
select * from b
Sridhar,
Thanks a lot for your help.My exact need was to delete records in 50 tables starting with the key table for a specific condition in the key table.
Assume table A has 100 records,B 200 records,C 150 records,D 400 records, etc
When i want to delete some records in table A, i will not be able to do that as child records exists in table B and this structure will carry on till that last table in my application. How do i delete those specific records
Venkatesh -
Delete records from internal table
hi all,
i want to delete records from intenal table which are starting with a particular starting number .
eg internal table
10000
20000
90000
91000
92000
88880
i want delete the records starting with 9 i.e. 90000 91000 92000.
Thanks in Adv
RAJYou can test this piece of code.
DATA:
i_tab TYPE STANDARD TABLE OF mara,
wa_tab TYPE mara.
wa_tab-matnr = '1000'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1002'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1003'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '2001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '3001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '4010'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:49 PM -
Delete records from multiple table
Hi,
I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
Kindly Help.
Thanks,
Alexander.Hi Tim,
Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
Technically, there are other ways of deleting from multiple tables with one statement.
1. "Use a trigger":
What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
2. Dynamic SQL:
Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
3. Using Foreign-Key constraint with Cascade-Delete:
This I feel is a more 'cleaner' way of doing this.
Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind. -
Deleting records from a recursive table query
Hi All,
I have the follow query, I would like to ask for your help, please: we use recursive tables for various purposes and one of them may have 100,000's records.
What would be the best approach to delete records from such a table?
I was thinking about two below, but any additional one will be more than welcome as well:
(1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?
(2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.
Thank you in advanceHi,
kdwolf wrote:
... (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?Sorry, I'm not sure whqt you mean by "I will run on my_table twice". Assuming you don't already have a foreign key constraint (as you described below) I don;t know any other way, let alone a more efficient way, to get the same results.
(2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.You're right; a foreign key constraint always costs a little whenever you do DML. Someone who knows your application and your system as well as you do will have to decide if the benefit of having accurate, consistent data justifies that additional cost. If you're not sure, I suggest you add the constraint.
One advantage of having a foreign key constraint is that you can create it with the "ON DELETE CASCADE" option. Then, if you simply say "DELETE FROM my_table WHERE my_table_patrent_id = X", all the descendants of those rows will automatically be deleted, exactly as you requested in (1) above. -
Deleting records from internal tabl
Hi All,
Here i need delete records from one internal table, from another internal table. both contains same field as name1, so here , i need to delete records from t_itab , the records which are existed in t_itab1.
first internal table t_itab contains
vinesh01
vinesh02
vinesh03
vinesh04
second internal table t_itab1 contains
vinesh01
vinesh02
here i need to delte t_itab1 entries from t_itab.
regards,
vinesh.Hi,
try this code.
first internal table t_itab contains
vinesh01
vinesh02
vinesh03
vinesh04
second internal table t_itab1 contains
vinesh01
vinesh02
loop at t_itab1.
loop at t_itab.
if t_itab-name1 = t_itab1-name1.
delete t_itab.
(OR)
delete itab where t_itab-name = t_itab1-name.
endif.
endloop.
endloop.
regards.
sriram. -
Deleting records from Z table via an ABAP
Hello hoping someone can help me
I am about to start writing an abap that will delete records from three seperate z tables that have been in there for over 18 months.
Hoping that someone can give me a shove in the right direction to start me off as never had to do anything like this before.
Iv had a search through the forum but cant seem to find what im after
ThanksHi,
The below statement will do the purpose.
DELETE zcustom FROM TABLE ITAB. -
Help needed writing trigger for deleting records from multipul tables
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_audit872959 wrote:
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_auditutilize appropriate WHERE clause -
Deleting records from compared tables...
Hi all,
I know there are a bunch of posts regarding this issue...but I don't see one that quite fits this scenario. I have two tables with the exact same structure...with key field matnr. I want to delete all of those records from table A where the material does NOT exist in table B. Is there a terse way to accomplish this?Suresh and Ravi,
you are real good contributors to this forum and i like that.
Not that you give a LOT of answers, your answers even porve quality.
BUT i have one thing. People asking questions here are sometimes not TOO used to the ABAP syntax and other concepts.
SAP noticed that themselves and made some concepts "obsolete", to get a code which is better to read. Especially for newbies.
And well HEADER LINES are obsolete by now.
People not beeing really used to ABAP will have really big Problems in reading things like:
Loop at itab.
endloop.
or even harder:
modify itab.
this shall not be critic in any way, but rather a suggestion on how you can help the better. Accoring to your number of posts thats what you actually want.
thx for convenience. -
Delete records from two tables
Hi All,
I have two tables (tableA and tableB) and i have four combination primary key.
How can I delete the records from tableA that are not in tableB?
In my sample below I need to delete the records from year 2013.
I have a loop to insert the new ones.
Thanks
Johnny
create table tableA(
keyA_id number,
keyB_id number,
keyC_id number,
keyD_id number,
amount number,
CONSTRAINT "PK_TABLEA" PRIMARY KEY (keyA_id, keyB_id, keyC_id, keyD_id)
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2011,10);
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2012,40);
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2013,20);
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2011,10);
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2012,30);
insert into tableA(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2013,20);
create table tableB(
keyA_id number,
keyB_id number,
keyC_id number,
keyD_id number,
amount number,
CONSTRAINT "PK_TABLEB" PRIMARY KEY (keyA_id, keyB_id, keyC_id, keyD_id)
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2011,10);
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2012,40);
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,1,2014,40);
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2011,10);
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2012,30);
insert into tableB(keyA_id,keyB_id,keyC_id,keyD_id,amount)
values(1,1,2,2014,30);r you trying to do something like below ?
Delete from TableA A
where not exists (select 1 from TableB B where
A.keyA_id=B.keyA_id and
A.keyB_id=B.keyB_id and
A.keyC_id=B.keyC_id and
A.keyD_id=B.keyD_id) -
Any way to restore deleted record from VBAP table.
Hi Guru,
Is their any way to restore deleted record from vabp.
Back is taken but , All quality server back is taken, any way to restore only
deleted VBAP data from all Back.
Regards
DurgeshHi Sahu ji,
you will not be able to get those records.
Check this : If this issue is in Development than no need to worry.
If in quality and production , then usually a copy of the system is there , and this can help you.
Also , check is there any report that exports this data in some other form for backup.
Hope it help you.
Maybe you are looking for
-
why is it when i am trying to syc my music to my iphone but it says i have authorised my laptop...but i have authorised it! how do i stop this and get my music onto my iphone?
-
With iOS 8.02 , not able to connect Bluetooth devices
Not able to connect with my car audio and headphone after I updated 8.02
-
TIFF or JPG to PNG or RAW (Automator) Utility?
I am coming from PC and see that I am still having issues with somewhat reflexively exporting images from Aperture (for upload to an ftp site or for other reasons for instance) - and I see that I now have images both on my desktop and in my Documents
-
Error Creating Document Set in a Custom Sandboxed Action
I created a custom workflow sandboxed action, and one of the lines is required to create a new document set in a document library. The code works when i run it in a console application. The document set is created successfully. However, it doesn't i
-
AirPort Time Capsule Explosion
hi. oh well... today was a normal working day and suddenly the AirPort Time Capsule issued a very loud explosive sound... then the electricity of my office goes out (electricity breakers out). the sounds was similar like an condensator explosion. (no