RE:[sap-abap] Deleting records directly from a transparent table using custom ABAP program
Posted by
Admin at
Share this post:
|
0 Comments
| Posted by jazz627 on Aug 5 at 2:18 AM | |
Hi All,
Thank you for all your inputs, actually the table I was asked to do a
DELETE is in table KNVK. I said that this is not a good idea because it
may have, as mentioned, "strand" records in other tables. But, it is not
my decision anymore, they are adamant that I do it this way. That's why I
need to make sure that what I will be doing is the correct one, and I'm
not really familiar with using COMMIT.
So, if I understand it right it does not matter if I do a COMMIT or not,
the record will still be deleted from the database table. So, basically I
can just do it like this...
(I apologise if I oversimplify the code)
PARAMETERS: p_parnr LIKE knvk-parnr,
p_kunnr LIKE knvk-parnr.
DELETE * FROM knvk
WHERE parnr EQ p_parnr
AND p_kunnr EQ p_kunnr.
IF sy-subrc NE 0.
ROLLBACK WORK.
MESSAGE ID l_v_msgid TYPE c_msgtyp_err NUMBER l_v_msgno
WITH l_v_msgv1 l_v_msgv2 l_v_msgv3 l_v_msgv4.
ELSE.
COMMIT WORK.
ENDIF.
But, if there a safer way such as a BAPI that will delete records from
KNVK then I'll rather use that.
Thanks and Regards.
"epalmer via sap-abap" <sap-abap@Groups.ITtoolbox.com>
08/05/2009 01:38 AM
Please respond to
sap-abap@Groups.ITtoolbox.com
To
jazz627 <jasper.borra@coats.com>
cc
Subject
RE:[sap-abap] Deleting records directly from a transparent table using
custom ABAP program
Posted by epalmer (SR ABAPS Systems Developer)
on Aug 4 at 1:39 PM
Mark as helpful
Jasper as others have said, you should never issue a direct delete to the
database especially for a table such as MARA or VBAK. As to the people who
want it done, I would be talking to their bosses if need be. The commit or
not is the least of your worries and really doesn't matter. All a commit
does is create a rollback point. Attached to the Mara is the MARC, MLAN,
MARM, MAKT, and MBEW. So it crosses Purchasing, Material, and Accounting
areas. It is called Master Data.
__.____._ Thank you for all your inputs, actually the table I was asked to do a
DELETE is in table KNVK. I said that this is not a good idea because it
may have, as mentioned, "strand" records in other tables. But, it is not
my decision anymore, they are adamant that I do it this way. That's why I
need to make sure that what I will be doing is the correct one, and I'm
not really familiar with using COMMIT.
So, if I understand it right it does not matter if I do a COMMIT or not,
the record will still be deleted from the database table. So, basically I
can just do it like this...
(I apologise if I oversimplify the code)
PARAMETERS: p_parnr LIKE knvk-parnr,
p_kunnr LIKE knvk-parnr.
DELETE * FROM knvk
WHERE parnr EQ p_parnr
AND p_kunnr EQ p_kunnr.
IF sy-subrc NE 0.
ROLLBACK WORK.
MESSAGE ID l_v_msgid TYPE c_msgtyp_err NUMBER l_v_msgno
WITH l_v_msgv1 l_v_msgv2 l_v_msgv3 l_v_msgv4.
ELSE.
COMMIT WORK.
ENDIF.
But, if there a safer way such as a BAPI that will delete records from
KNVK then I'll rather use that.
Thanks and Regards.
"epalmer via sap-abap" <sap-abap@Groups.ITtoolbox.com>
08/05/2009 01:38 AM
Please respond to
sap-abap@Groups.ITtoolbox.com
To
jazz627 <jasper.borra@coats.com>
cc
Subject
RE:[sap-abap] Deleting records directly from a transparent table using
custom ABAP program
Posted by epalmer (SR ABAPS Systems Developer)
on Aug 4 at 1:39 PM
Mark as helpful
Jasper as others have said, you should never issue a direct delete to the
database especially for a table such as MARA or VBAK. As to the people who
want it done, I would be talking to their bosses if need be. The commit or
not is the least of your worries and really doesn't matter. All a commit
does is create a rollback point. Attached to the Mara is the MARC, MLAN,
MARM, MAKT, and MBEW. So it crosses Purchasing, Material, and Accounting
areas. It is called Master Data.
Copyright © 2009 CEB Toolbox, Inc. and message author.
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Related Content
In the Spotlight
White Papers
In the Spotlight
SAP Enterprise Software: flexible, best-of-breed business apps View Vendor Profile
View this thread online
Manage group e-mails
Create an FAQ on this topic
Tell us what you think
Unsubscribe from discussion
Manage group e-mails
Create an FAQ on this topic
Tell us what you think
Unsubscribe from discussion