10-12-2007 10:54 AM
hi experts,
i have one small doubt is is it possible to delete standard table records from data base.
10-12-2007 10:58 AM
Hi,
yes....
it is possible
but being a developer we should not do this...
before going ahead you have to contact your functional consultant..
get the approval...
any how i am giving the solution
go to se14
give the table name
click table radio button
and at the botom
delete data button will be there clik it and
then
clik the button avtivate and adjust data base
then all the records will be deleted from that standard table or even the ztable
regards,
Venkatesh
10-12-2007 11:03 AM
10-12-2007 11:13 AM
it is possible , but u should not do this through programs as it may create inconsistency in SAP data.
10-12-2007 11:13 AM
Hi
yes it is possible to delete records from the datbase table
but DOn't delete data directly
it may become problem in feture
<b>reward if usefull</b>
10-12-2007 11:15 AM
hi,
it is not advisable to delete the records from standard table.
but here is the code to delete a record from a table.
PARAMETERS p_carrid TYPE sflight-carrid.
DELETE FROM sflight
WHERE carrid = p_carrid AND
fldate = sy-datum AND
seatsocc = 0.
Reward Point if find this helpful
Regards
Siva
10-12-2007 11:17 AM
Hi
Inconsistencies in SAP tables can arise from various sources. It is sometimes difficult to find them. I see that many of your questions here relate to scripting.
Irrespective of whether you found this "problem" via any of a number of obscure reports, or the accountants have reconciled the database tables manually in Excel or Access to check that everything is okay, or you might have used transaction F190 to check consistency of all the dependent tables => you will hopefully be able to reconstruct the problem using that transaction (F190).
For more information, read the documentation on the transaction (or report SAPF190 from SE38). Use "classic mode" for more details (to the line item).
It will mention a SAP note (I am not logged on, but it is in the docs) which will help you further in analysing, and also contains 4 reports which you can use to correct inconsistencies, if I remember correctly. Might be more by now because it has been a while.
As mentioned before, do not manually or directly delete from those tables.
If the above procedure does not work for you, contact SAP via "OSS". They might need to logon to your system, and might
<b>reward if usefull</b>
10-12-2007 8:33 PM
DELETE - The statement used for deleting records From a Database Table.
DELETE statement deletes lines from a database table). You can specify the name of the database table either in the program itself with DELETE FROM dbtab ... or at runtime as the contents of the field dbtabname with DELETE FROM (dbtabname) .... In both cases, the database table must be known to the ABAP Dictionary. Only data from the current client is usually deleted. You can delete data using a view only if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction".
One must take a note that:-
Notes
1. The DELETE statement does not perform authorization checks. You must program these yourself.
2. The final (irrevocable) deletion of lines with the DELETE statement is not performed until after a database commit (see Logical Unit of Work (LUW)). Prior to this, you can reverse any database update with a database rollback.
3. You cannot rely exclusively on the locking mechanism of the database system to synchronize several users trying to access the same dataset at the same time. You should therefore use the SAP locking mechanism.
DELETE belongs to the Open SQL command set.
Various forms of DELETE statement:-
1) DELETE FROM dbtab WHERE condition.
DELETE FROM (dbtabname) WHERE condition.
Deletes lines in a database table that satisfy the WHERE clause cond. With this variant, specification of a WHERE condition is obligatory .
When the statement has been executed, the system field SY-DBCNT contains the number of deleted lines.
The Return code is set as follows:
SY-SUBRC = 0:
At least one line was deleted.
SY-SUBRC = 4:
No lines were deleted, since no line was selected.
2) DELETE dbtab.
DELETE *dbtab.
DELETE (dbtabname) ...
These are SAP-specific short forms used to delete one line of a database table. If the name of the database table is specified in the program, the primary key of the line to be deleted is taken from the specified work area - dbtab or *dbtab. If the name of the database table is not determined until runtime ( DELETE (dbtabname) ...).
When the statement has been executed, the system field SY-DBCNT contains the number of deleted lines (0 or 1).
The Return code is set as follows:
SY-SUBRC = 0:
The line was deleted.
SY-SUBRC = 4:
No lines could be deleted, since no line exists with the primary key specified.
3)DELETE dbtab FROM TABLE itab.
DELETE (dbtabname) FROM TABLE itab.
For Mass deletion: Deletes all database table lines for which the internal table itab contains values for the primary key fields. The lines of the internal table itab must satisfy the same condition as the work area wa in addition 1 to variant 2.
The system field SY-DBCNT contains the number of deleted lines, i.e. the number of lines of the internal table itab for whose key values there were lines in the database table dbtab.
The Return code is set as follows:
SY-SUBRC = 0:
All lines from itab could be used to delete lines from dbtab.
SY-SUBRC = 4:
For at least one line of the internal table in the database table, there was no line with the same primary key. All found lines are deleted.
4) DELETE dbtab VERSION vers.
DELETE *dbtab VERSION vers.
Deletes a line in a database table, the name of which is taken from the field vers at runtime. The database table must be known to the ABAP Dictionary and its name must conform to the following naming convention: It must begin with 'T' and can consist of four additional characters. The field vers must contain the table name without a leading 'T'. Only lines in the current client are deleted. The line to be deleted is taken from the statically specified table work area dbtab or *dbtab.
The Return code is set as follows:
SY-SUBRC = 0:
The line was deleted.
SY-SUBRC = 4:
No lines could be deleted because no line existed with the specified primary key.
Hope that the above information will help you in understanding basics of DELETE statement. Please reward points if you find the information provided above is useful.
10-13-2007 5:39 AM
You can Write a program for it .
But there should Delete Authroisation for the Program based on the Table , table primary field (MANDT,BUKRS,etc).
the program is
DELETE FROM sflight WHERE planetype = 'A310' AND
carrid = 'LH'.
This deletes all lines from SFLIGHT where PLANETYPE has the value A310 and CARRID contains the value LH.
Reward points if it is usefull ..
Girish
10-13-2007 6:01 AM
Hi,
If you have standard transaction to delete the record from the standard tables..Then use that..
For programming..It is advisable to do a direct table delete...Use a BAPI or BDC to delete the record..
Thanks
Naren