‎2008 Apr 02 8:47 AM
Hello.
I have to write data to database tables.
I write the data like this:
insert (tabname) from TABLE <it>.
<it> is a field symbol with the table contents to write..
How can I catch errors like 'duplicate records' or ...
There will probably be a lot of errors to catch. :d
Thx.
‎2008 Apr 02 9:23 AM
transaction SE11 for creating lock objects
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
‎2008 Apr 02 9:17 AM
best way is Enque (get the lock) . if you get lock successfully then you can update insert without err. & Deque after successfullt completing that operation.
This is required because otherwise you may get short dump also,
http://help.sap.com/saphelp_47x200/helpdata/en/ce/532b3a6b4f4644e10000000a11402f/frameset.htm
‎2008 Apr 02 9:23 AM
transaction SE11 for creating lock objects
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm
‎2008 Apr 02 10:29 AM
hmm.. So there isn't just a simple function like Try.. Catch in VB.net?
‎2008 Apr 02 10:36 AM
Hi,
we have the functionality same as try...catch in abap also.
please refer to this link
http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
rgds,
bharat.
‎2008 Apr 02 10:42 AM
‎2008 Apr 02 1:59 PM
it is easy task if you are updating std SAP table, because most of the cases lock will already exist.
So you can
call function enqueu_xxxx
then insert xxx
dequeue_all
**if lock does not exist, then you need to create in Se11.
e.g. for MARA table update/insert you can use existing function module
ENQUEUE_E_PDTC_MARA