05-06-2009 11:34 AM
Hi Experts,
I want to delete a single row from DBTAB ( KLAH )
WHERE KLAHKLART = '2' and KLAHCLINT = '241'.
Please advice
Karthik
05-06-2009 11:57 AM
Hi ,
Try this code To delete single record from DB table- -
DATA : t_klah LIKE TABLE OF klah,
fs_klah LIKE klah.
SELECT * FROM klah INTO TABLE t_klah
WHERE klart = '2' AND
clint = '241'.
LOOP AT t_klah INTO fs_klah.
DELETE klah FROM fs_klah .
EXIT.
ENDLOOP.
Regards
Pinaki
05-06-2009 11:38 AM
Hi Karthik,
Deleting data from a standard table is not advisable.
Please search the forum before posting your query.
YOu can type the delete statement in your abap editor and press f1 on it.
YOu can get the usage of the delete statement for DBTABs
Regards,
Ravi
05-06-2009 11:39 AM
hi karthik,
Try the below code
data : wa_klah type klah.
select single * from klah into wa_klah where KLAHKLART = '2' and KLAHCLINT = '241'.
delete klah from wa_klah.
Thanks,
Vamshi
05-06-2009 11:42 AM
05-06-2009 11:57 AM
Hi ,
Try this code To delete single record from DB table- -
DATA : t_klah LIKE TABLE OF klah,
fs_klah LIKE klah.
SELECT * FROM klah INTO TABLE t_klah
WHERE klart = '2' AND
clint = '241'.
LOOP AT t_klah INTO fs_klah.
DELETE klah FROM fs_klah .
EXIT.
ENDLOOP.
Regards
Pinaki
05-06-2009 12:03 PM
05-06-2009 12:05 PM
To all who replied with a piece of code to do the deletion: and what happens with the records in the other database tables that are related to the deleted KLAH record?
05-06-2009 12:39 PM
As others mentioned deleting data from database table is not recomended.
If you are pretty sure then you can try this way.
data: lv_tabix type sy-tabix.
select single * from klah into wa_klah
where KLAH~KLART = '2' and KLAH~CLINT = '241'.
lv_tabix = sy-tabix.
delete klah index lv_tabix.
Regards,
Lalit Mohan Gupta.
05-06-2009 1:59 PM
Hi,
I am not advising you for deletion of data of standard table as it is not the standard process.
In case of emergency you can use delete command. But I must say you have to first consult your scenario
with SAP(SAP Online Portal) than only use delete command.
Regards,
Himanshu