‎2007 Feb 08 6:56 PM
Hi,
I am in a custom transaction and am using a lock object to lock the production order I am working with. Further down in the logic, I am using a bapi to create a notification. After this call, the lock gets released. Is there any way in which I could ensure that the lock is not released even after the bapi executes?
Thanks
‎2007 Feb 08 7:13 PM
Hi,
One way you can enforce the lock till the end is,
find out the LOCK object (ENQUEUE func. module) which is used to lock the production order,
Now before your BAPI call, again execute this func. module and release the lock after bapi is committed.
Regards
Subramanian
‎2007 Feb 08 8:03 PM
Hi,
Does the BAPI you are calling doing a commit work ? Then it is the commit work that clears the lock.
Usually BAPIs have a parameter in its interface with whihc you can tell whther to do a commit or not ....if the parameter is available then use this to tell the BAPI not to do a commit...and do the commit from your program later ....btw which BAPI are you using?
Thanks.
‎2007 Feb 08 8:17 PM
Hi Deepu,
Yes, the bapi IQS4_CREATE_NOTIFICATION has a parameter I_COMMIT that commits work and I guess this is what is releasing the locks. However, I do need to commit work since I need the notification number returned by the bapi in downstream processing...
Thanks.
‎2007 Feb 08 8:37 PM
Hi Tessy,
Whatever value you pass to I_COMMIT, you will get the notification number back...however it won't be commited yet into the database tables...
So you can commit it from your program....Now if you are accessing details of the notification before doing commit, obviously that will fail....
So call the BAPI without commit and do your processing as your require..maybe you just need the notification number...so do your activities and then commit..
Thanks.
‎2007 Feb 08 8:46 PM
Hi Deepu,
No, that did not work. I passed I_COMMIT as space to the bapi but still the lock is getting released..
Thanks,
Tessy
‎2007 Feb 08 8:18 PM
Hi tessy,
Use transaction SM12 Lock entries to see lock entries
Naming: The lock object name must start with EZ
Create the lock object for the required table using SE11. When you create the locl object, two function
modules will be created automatically. These two function modules named
ENQUEUE_<lock object name> and DEQUEUE_<lock object name> can be called to lock or dislock
the table.
Example:
Create a lock object for table MSEG called EZTESTLOCK.
When you has created the lock object, the two function modules
ENQUEUE_EZTESTLOCK
DEQUEUE_EZTESTLOCK
Will automatically be created
REPORT lockentries.
PARAMETERS:
p_mbelnr LIKE mseg-mblnr DEFAULT '4900008001',
p_mjahr LIKE mseg-mjahr DEFAULT '2001',
p_zeile LIKE mseg-zeile DEFAULT 1,
p_lock RADIOBUTTON GROUP lock,
p_unlock RADIOBUTTON GROUP lock.
START-OF-SELECTION.
IF p_lock = 'X'.
Lock item
CALL FUNCTION 'ENQUEUE_EZTESTLOCK'
EXPORTING
MODE_MSEG = 'E'
MANDT = SY-MANDT
mblnr = p_mbelnr
mjahr = p_mjahr
zeile = p_zeile
X_MBLNR = ' '
X_MJAHR = ' '
X_ZEILE = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSEIF p_unlock = 'X'.
Unlock item
CALL FUNCTION 'DEQUEUE_EZTESTLOCK'
EXPORTING
MODE_MSEG = 'E'
MANDT = SY-MANDT
mblnr = p_mbelnr
mjahr = p_mjahr
zeile = p_zeile
X_MBLNR = ' '
X_MJAHR = ' '
X_ZEILE = ' '
_SCOPE = '3'
_SYNCHRON = ' '
_COLLECT = ' '
.
ENDIF.
Regards
Sreeni