Deletion of entries from a table whose name is controlled by Z program.
Hi all,
I have to delete all entries in a custom table whose "Name" has a certain pattern say ZDBTAB01, ZDBTAB02, etc.
I arrive at the table name through ABAP code. But the statement
"DELETE FROM tab_name" doesnot work where tab_name is a variable.
Can anyone suggest a function module to perform this action..??
Thanks.
Regards,
Senthil G.
data : v_tabname ..... value 'ZXXX'
delete from (v_tabname).
It should work. Are you getting any error message as such.
Similar Messages
-
Delete a user from a table whose name is a foreign key in other tables
Dear All;
I am trying to figure out an easy way to do this. I just recently took someone application who utilized 500 tables. I am trying to delete a user from a table called member_table. However, I am having problems doing so because the user name is a foreign key in other tables which has a relationship with this member_table. I really can't naviagte through all 500 different tables and start deleting the user from each table . hence, I would like to figure out a way to delete the user from the member_table without getting the error message
ORA - 02292 "Integrity Constraint (....) violated child record foundUnless you want to find and re-create all of the FK's that point to that field so you can make them ON DELETE CASCADE (note it is the FK not the PK that has that attribute), you will need to either delete that member id from each of the child tables individually or update each one individually to either null or some valid value in member_table before you can delete the id from member_table.
You can find all of the tables, and the corresponding column_name that have an FK relationship to memeber_table with the following:
SELECT c.table_name, col.column_name
FROM user_constraints c, user_cons_columns col
WHERE c.constraint_name = col.constraint_name and
c.r_constraint_name = (SELECT constraint_name
FROM user_constraints
WHERE table_name = 'MEMBER_TABLE' and
constraint_type = 'P') and
c.constraint_type = 'R';If there are a lot of these, you could use something similar to generate the set of delete/update statements that would be needed.
John -
How to do a select from a table whose name is saved in a field?
Hello,
This is an abap report.
I need to do a select from a table whose name is saved in a field of Z* table.
Like this..
SELECT * FROM znodos.
SELECT * FROM znodos-tabla. "znodos-tabla contain the Z* table name
move zodos-tabla-txtmd to.....
endselect.
endselect.
Is this possible??
ThanksHi Ilie Aleman
Give variable name in ().. Variable name refers to variable which contains table name
SELECT * FROM (znodos-tabla).
Regards,
Mohaiyuddin
Edited by: Mohaiyuddin Soniwala on Jan 22, 2008 5:18 PM -
How to delete the entries from NAST table
Hi,
Please help me out by providing any function module that delete's the entries from hte NAST table.
Regards,
Kiran.LREPORT ZSCD_TEST13.
delete from nast where VSTAT = '1'.
=====
If you see the FM : NAST_DELETE_OBJECT, its only useful when NACHA = 7 (i.e. message transmission medium = Simple Mail)
For others its not useful.
We had similar issue few days back and after long RnD, we straightaway deleted the entries using the Zprogram.
regards,
Edited by: Pranu Pranu on Aug 19, 2008 1:42 PM -
Deleting entry from internal table
Hi Experts,
i have the following internal table:
data : it_result1 TYPE crmt_object_guid_tab
and work area
data : wa_result1 type crmt_object_guid.
i have to delete a guid from internal table based on some condition.
loop at it_resul1 into wa_result1
if lv_priority eq priority.
delete this entry from internal table.
endif.
endloop..
i tried using delete table it_result with table key CRMT_OBJECT_GUID = wa_result. but this is giving syntax error.
what should be done to delete the entry?
Thanks and regards
ShilpiHi
Check Syntax for DELETE operator on pressing F1
1. DELETE itab.
2. DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.
3. DELETE TABLE itab [FROM wa].
4. DELETE itab INDEX idx.
5. DELETE itab FROM idx1 TO idx2.
6. DELETE itab WHERE logexp.
7. DELETE ADJACENT DUPLICATES FROM itab.
delete table it_result with table key CRMT_OBJECT_GUID = wa_result
this is wrong
delete it_result where CRMT_OBJECT_GUID = wa_result
Edited by: Lavanya K on Apr 22, 2009 10:20 AM -
Removal of Developer Key entry from DEVACCESS Table.
Hi,
On table DEVACCESS, in QTY/DEV/Prod there is one person with Developer Key listed that I would like to remove, User is no more working and now we want to delete the entry from this table which has the User name followed by the Developer key assigned.
Could any one guide me in deleting the Developer Key access from the DEVACCESS table.
Satish.Another alternative is to use SE11 to create a maintenance view (ex: ZV_DEVACCESS). Secure the maintenance view with a custom authorization group. With the maintenance view you have the ability to use SM30 to maintain the DEVACCESS data.
That keeps the DEVACCESS table from changing and thus no need to register the change with SAP.
Cheers,
Brian -
Delete all entries from the following tables - Follow-up Activities (oracle)
Hello,
I performed a homogeneous system copy of our development BW system with the database (oracle 11.2.0.3) from the BW production system!
I already start the oracle database and the SAP system in the target system/server (development BW system) and I´m doing some follow-up activities. One of this activities is (at the system copy guide 6.2.3.2 Activities at Database Level) is to delete all entries from the following tables:
DBSTATHORA, DBSTAIHORA, DBSTATIORA, DBSTATTORA
I tried to delete them using SQL Plus:
sqlplus /nolog
SQL> connect /as sysdba
SQL> delete from DBSTATTORA;
delete from DBSTATTORA
ERROR at line 1:
ORA-00942: table or view does not exist
... and it show me that error message.
This is strange because when I go to transaction SE14 and check the DBSTATTORA I see that table exist and contain a lot of entries!
Why this is happened in SQL Plus!? I´m running the correct SQL statement for doing this type of task or not?
How can I delete the entries of that tables? Can I do that using the transaction SE14?
Can you help me please?
Thank you,
samid raifHello
sqlplus /nolog
SQL> connect /as sysdba
SQL> delete from DBSTATTORA;
delete from DBSTATTORA
ERROR at line 1:
ORA-00942: table or view does not exist
It doesn't surprise me as you are not mentioning the schema name here. Instead it should be
delete from SAPSR3.DBSTATTORA;
Assuming the schema owner is SAPSR3. if the owner is different then replace that with the correct one.
Regards
RB -
Delete entry from Database table
Hi,
I configured one PCR scenerio in SPRO node -> business Packakes/ funtional packages-> Manager self service-> Personal Change request -> Group Change request scenerio.
later I deleted that entry in backend, but still the same entry exist in db table "TWPC_PCR_Groups" .
How can we delete that entry?
thanksHi,
If you just want to delete a single entry from database table then you have to it in debug mode .
go to se11->Give table name->Press F7( ie: display table entries)-> Goto the table contents (CTRLSHIFTF10)->Select the entry you want to delete->Give /H in the command bar ->enter into debug mode-> Give code as DELE -> save it. and press enter. Your entry will be deleted from database.
Hope this helps.. -
Delete an entry from table T527X.
Hello Gurus,
How can we delete an entry from table T527X from se11/se16? Or is there any other transaction by which we can delete this entry? I can not delete the org unit as this org unit is not having any name and the ID is: 00000000. I created this entry using SE11 -> utilities -> Create entry.
Thanks,
Chakri.When you say select the entry or you double clicking?
You can try this.. simply select the check box against that entr in the displayed list and then use the menu option Table Entry--> Delete
Other than, this I can't think of another option.. ofcourse you can always have a simple custom program with a couple of lines of code to delete a table entry.
~Suresh -
Hi folks,
I have delete program to delete entries from a custom table and has only one feld in it.
tables: ZABC
selection-screen begin of block B1 with frame title text-110.
select-options: P_KOSTL for ZABC-KOSTL.
selection-screen end of block B1.
delete from ZABC where KOSTL in P_KOSTL.
Upon executing I am entering certain cost center ids on the selection screen to delete them from the table.It did not work.
what is it I am missing?
Thanks,
SKHi,
Try this sample code..Replace ZABC with your table..
TABLES: ZABC.
selection-screen begin of block B1 with frame title text-110.
select-options: P_KOSTL for ZABC-KOSTL.
selection-screen end of block B1.
START-OF-SELECTION.
* Delete the records from the table.
DELETE FROM ZABC where KOSTL IN P_KOSTL[ ]. " [] for the select-options.
IF sy-subrc <> 0.
ROLLBACK WORK.
ELSE.
COMMIT WORK.
ENDIF.
Thanks,
Naren -
Problem in deleting entries from internal table
i am selecting
vrgar
perio
paobjnr
belnr
gjahr
perde
budat
kndnr
artnr
frwae
kursf
rec_waers
kaufn
kdpos
bukrs
kokrs
werks
gsber
vkorg
vtweg
spart
rbeln
rposn
prctr
pprctr
kunnr
land1
regio
kunwe
kvgr1
wwpmg
zterm
wwcst
wwrst
mvgr3
wwseg
wwcls
wwesa
prdha
wwbun
wwexd
wwph1
wwph2
wwph3
wwph4
prat1
prat2
vrprs
vv510
vv508
vv509
vvqt2
vv515
INTO TABLE ct_ce11000 FROM ce11000
WHERE paledger EQ gv_ledbo AND
vrgar EQ lc_vrgar AND
belnr GT uv_belnr AND
gjahr EQ pa_gjahr AND
perde EQ pa_perd AND
bukrs EQ pa_bukrs.
now i awant to delete all those entries from my internal table ct_ce11000 where my plant (WEKRS) and company code (BUKRS)
i am writting
loop at ct_ce11000 into wa_ce11000.
if wa_ce11000-werks ne wa_ce11000-bukrs.
now how can i delete all the entries from nmy internal table (ct_ce11000) when plant and company code is not same
pls help me with logic.
thank you for helping meHello Guys,
It is not advisable to delete the entries from the internal table you are looping upon. See this thread: [Sy-tabix in loop : Doubt|Sy-tabix in loop : Doubt]
And to answer the OP's question select data into some local internal table & based on the condition populate your final table. Creating a local table of the same type as the final table will not create too much performance overhead
Cheers,
Suhas -
Delete entries from Database table t71inp1
Hi,
I want to Delete entries from Database table t71inp1. Its a H R Table. I want to know the exact code.
i saw the cide delete bkpf where usnam = p_name.
Will it work the same here. Also.
Please let me know.
I hope to get reply from you soon.
where should i write the code. i.e. Tcode SE38 and directly deeleting write the code.
Please give me some inputs. I am new to H R ABAp
Shivakumar K B
919886920258hi
You can write a program in se38.
create a program.
use delete from t71inp1 where<condition> command in it. -
Size or delete unwanted entries from tables AllDocStreams,AllDocVersions,EventCache,EventLog of Sharepoint 2010 content database:
We using powershell scripts to migrate data between two sharepoint 2010 sites .
While doing migration we delete all document libraries & list form destination site and then run powershell to migrate data from source to destination. We following this process
twice in a week.
But in doing so we found the above mention tables (AllDocStreams,AllDocVersions,EventCache,EventLog ) of destination Sharepoint Content database are growing at an alarming rate.
Wish to know how could get rid of unwanted data stored in these tables.Hi,
This is old thread but here is your answer for some of the tables you mentioned
http://blogs.msdn.com/b/sowmyancs/archive/2012/06/29/alldocversions-amp-alldocstreams-table-size-after-upgrading-to-sharepoint-2010.aspx
Cheers -
I cannot delete multiple entries from table
Hi
i am trying to delete multiple entries from table while keeping some data.
for example I have the following table
Plant Item
US101 777
US101 888
US101 999
US101 666
I want to keep the rows where the item is 777 and 888 for plant US101 and keep delete the rest data
I wrote the following code
Delete source_package where Plant = 'US101' and Item NE '777' or '888'.
but all the rows get deleted.
I tried deleting single row and it worked.
Delete source_package where Plant = 'US101' and Item NE '777' .
How can I delete multiple rows.
thanksHi Bhat Vaidya,
Plz refer the following code.. IT will solve ur problem..
REPORT ZSDN_TEST.
data: BEGIN OF it_data OCCURS 10,
plant(4),
item_num TYPE string,
END OF it_data.
data: str type string.
data: it_final like it_data OCCURS 10 WITH HEADER LINE.
it_data-plant = 'US01'. it_Data-item_num = 777. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 888. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 999. append it_data.
it_data-plant = 'US01'. it_Data-item_num = 666. append it_data.
delete it_data where plant = 'US01' and item_num ne 777 and item_num ne 888.
LOOP AT it_data.
write:it_data-plant,it_data-item_num.
skip.
ENDLOOP.
Regards,
Apoorv -
How to perform a select op on a table whose name is contained by a variable
I am using Oracle SQL*Plus client.
declare
tablename_var varchar(10); LOOK HERE
date_var date;
begin
select sysdate
into date_var
from &tablename_var; LOOK HERE
dbms_output.put_line('The system date is '||date_var);
end;
The above code prompts the user to enter a value for the variable tablename_var, once the user enters 'dual' on prompt... The system date is given as output.
declare
tablename_var varchar(10):='dual'; LOOK HERE
date_var date;
begin
select sysdate
into date_var
from tablename_var; LOOK HERE
dbms_output.put_line('The system date is '||date_var);
end;
This code fails and gives an error. I understand. Engine interprets it as... trying to perform a select operation on a variable, and says a table or a view is expected.
Can someone please tell me what to do, to perform a select operation on a table whose name is contained by a variable, like above?Hi,
Welcome to the forum!
You need Dynamic SQL if the table- or column names are variables.
Getting the current date isn't a good example; you could get that without a query simply by saying
date_var := SYSDATE;Also, SELECT ... INTO will raise an error if the query does not return exactly 1 row.
In the example below, let's get the latest entry_date from a given table:
For example:
declare
tablename_var varchar(10);
date_var date;
sql_txt VARCHAR2 (1000);
begin
tablename_var := 'table_x;
sql_txt := 'select MAX (entrydate)'
|| ' from ' || tablename_var;
dbms_output.put_line (sql_txt || ' = sql_txt'); -- Not essential, but recommended
EXECUTE IMMEDIATE sql_txt INTO date_var;
dbms_output.put_line ('The latest entry_date is ' || date_var);
end;Dynamic SQL involves creating a string that contains the SQL statement. Displaying the string is purely optional, of course, but it's a very good idea when writing and de-bugging code. Remember to comment-out or delete the display before moving the code into Production.
For an exercise, make the column name a variable, instead of the hard-coded entry_date.
Edited by: Frank Kulash on Nov 5, 2009 9:20 AM
Maybe you are looking for
-
White space handling dbms_xmlstore.insertxml
Hi, I have a question about white space handling. I have a column in table which holds white space character. When I loading xml file using dbms_xmlstore.insertxml white space is converted into NULL and inserted into table. It would fail if the colum
-
How to create a batch by adding a record to any Z Table
Hi Experts, I am doing online billing info system. I need to quey the NAST table for unprocessed entries. One of the requirement is to create a batch What is meant by creating a batch by adding a record to a Z Table? If anyone is aware, please tel
-
need massive help itunes hasnt opened for months now and need it to work but i CANNOT loose my music and pics etc so dont know what to do and i cant get ios5 without it ive done everything please help!!!
-
After iTunes 6 international categories is a mess!
After Apple release of iTunes 6, International categories are a complete mess, even if you still use an old iTunes version like 4.9 or 5.01. Used to have a subcategory for selecting countries, like Brazilian for Brazil or Canadian for Canada. Now jus
-
Just updated to iOS7. Pulled-down new Notification screen and all it contains is a summary of my calendar for today and tomorrow.and stocks I want to be able to see the weather but it is not visible on this screen. Can't I do this anymore?