2015 Jul 14 7:25 AM
Hi Experts
I am having a problem, i am using the lock object ENQUEUE_EVVBAKE in BSP , Please find the sample code:
CALL FUNCTION 'ENQUEUE_EVVBAKE'
EXPORTING
VBELN = PF_VBELN
EXCEPTIONS
FOREIGN_LOCK = 2
SYSTEM_FAILURE = 3.
it is working fine in the debugging mode, When i press F8 or it comes out from the debugger system release lock object automatically.
Thanks
Arjun
2015 Jul 14 7:31 AM
Hi Arjun,
This is due to the fact that the Sales Document is already locked by another.. Please check the user ID which is locking it and if is not your user id then ask the user to come out of edit mode.
Or else delete the lock via, SM12..
It might be also due to ENQUEUE is done properly and DEQUEUE FM is not called after completing editing of SD.
Regards,
Deepan Swaminathan.
2015 Jul 14 7:42 AM
Hi
This lock is done by the code i have used . But in only debug mode after the FM called , But when I press F8 . It will release Lock automatically.
2015 Jul 14 7:43 AM
Hi
This lock is done by the code i have used . But in only debug mode after the FM called , But when I press F8 . It will release Lock automatically.
2015 Jul 14 7:47 AM
Please execute the code without debugging and check the result.
Regards,
Deepan Swaminathan
2015 Jul 14 8:09 AM
Hi,
I believe you have included DEQUEUE_EVVBAKE fm also next to this enqueue.
Try to regenerate the program and relogin again,test it.Some times this may be due to memory issues.
Let me know if the issue still persists.
Thanks,
Pawan.
2015 Jul 14 8:19 AM
Hi
I have put only ENQUEUE_EVVBAKE. If i am running this FM in SE37 , It is doing the same. If i come out from this FM it will release the lock automatically
My requirement is to lock the by my program sales order until unless i will not release that lock.
2015 Jul 14 8:25 AM
Please use FM DEQUEUE FM in the code.
Follow these steps,
1. Use ENQUEUE FM.
2. Process the SD document and Save the document.
3.Once saving is done, please use the FM DEQUEUE_EVVBAKE, to release the lock.
Try this and it will solve the issue.
Regards,
Deepan Swaminathan.
2015 Jul 14 8:32 AM
Hi all
I have design a custom UI via BSP. Now i want if user will open any sales order in UI than it should not be editable any other user in UI and SAP.
So i want to lock the sales order if that is open in UI.
Thanks
Arjun
2015 Jul 14 8:36 AM
Yes Arjun, i understand the requirement.
But what if the user saves the UI or closes the UI. In that case lock should be released.
If it is not released, then the lock will be there in the document forever. (Even if the same user tries to open the Document in different session, error message will be displayed informing that SD is already locked)
So you need to call the DEQUEUE FM, ince the user completes his work in UI.
Regards,
Deepan Swaminathan.
2015 Jul 14 11:22 AM
Hi Deepan
Exactly i have also develop a BSP to release the lock. But my first BSP is not working to lock the Sales Order. That is the main problem for me.
In the debug mode it will lock the SO after execution of SO, But when after FM execution when i press F8 it will release the lock automatically.
Regards
Arjun
2015 Jul 14 11:35 AM
Hi Arjun,
Place an external break point just before DEQUEUE FM and check if the Document is locked.
Check it from UI, Place external break point.
Regards,
Deepan.
2015 Jul 14 11:51 AM
Hi
I have put the break point ,yes the object is locked. But when i execute further it will release the lock automatically. I have also checked in SM12 also.
Even i have commented the DEQUEUE FM in my BSP but Don't know why the lock object is releasing.
2015 Jul 14 12:05 PM
Hi Arjun,
Initailly the Enqueue Fm(incorporated by you) is locking the sale order.
First try to identify where the lock is getting released.
I believe there is some standard code which is releasing the lock.If you want to to lock it or release it as per your requirement,try to put your code next to standard code using some enhancements.
Since you are calling from portal,i cannot replicate the issue in my system
2015 Jul 15 12:56 PM
2015 Jul 15 1:06 PM
Hi Arjun,
Have you tried the way that I suggested above.
regards,
Pawan.
2015 Jul 15 1:21 PM
Hi All
I have found on thing, In the debugger it is working fine , Because Lock object is active for the session when we execute the debugger or F8 it will release the lock automatically.If we can keep that session that it is possible.
So now how can i make a session active ?
Thanks
Arjun
2015 Jul 15 1:52 PM
Thats my understanding too - Locks are released automatically when the program execution is finished.
Ideally, you shouldn't be locking the sales order when the person opens it in a browser. Because he may just close the browser window and your program may be still holding the lock on the order. My suggestion would be to change the design of the program ....
1. User opens the order
2. User makes changes to the order and presses save
3. This triggers PAI event
4. Lock the order, Make changes to order, Unlock order
5. If lock fails, then wait and repeat for a certain amount of time. If still not successful, then display message to user
5. Refresh user display
Thanks,
Juwin
2015 Jul 16 8:28 AM
Hi
I also considered the close window case, At that time i have put the DEQUEUE FM.
I agreed with the logic Locks are released automatically when the program execution is finished. But How can i make that lock active?
If i can make that lock active , It will fulfill my requirement. At the close window time will release that lock
Thanks
Arjun
2015 Jul 16 2:07 PM
Problem is, there is no event triggered for "close window". So, you will not be able to clear the lock at that time.
Thanks,
Juwin
2015 Jul 15 4:31 PM
Hi
If you want the lock to be carried onto the V1 processes you have to set the _SCOPE = '3'. By default it takes '2'.
Explanation : ( From SAP Documentation ).
http://help.sap.com/abapdocu_70/en/ABENSAP_LOCK.htm
When you set an SAP lock using the ENQUEUE function module, the value transferred to the _SCOPE entry parameter determines the lock duration. Depending on the formal parameter _SCOPE, you can release an SAP lock as follows:
If you want to release an SAP lock using the DEQUEUE function module independent of the update function, you must transfer a value to the formal parameter _SCOPE that is greater than or equal to the value transferred to the parameter of the same name for the ENQUEUE function module.
Besides the _SCOPE parameter, the entry parameters of a DEQUEUE function module correspond to those of the ENQUEUE function module. You can then use the additional parameter _SYNCHRON to specify whether the release of the lock should be delayed until the program processing continues.
R
2015 Jul 16 8:29 AM
Hi Rudra
I have done this, But its not working. Please help me how can i make the lock active after execution?
Thanks
Arjun
2015 Jul 16 9:51 AM
Hi again,
Oh. I see.. You want the lock to be active even after your execution. Right?
Since you are using the standard lock. After execution when the update modules are processed correctly the lock will be released. as SAP uses the same lock object too and doing the dequeue for you even when send as _SCOPE = '3'.
If you want the lock to stay active after you should go for a different custom lock object.
But in that case you should handle the dequeue functionality by yourself.
R
2015 Jul 15 9:53 PM
Hi!
Did you Try this?
CALL FUNCTION 'ENQUEUE_EVVBAKE'
EXPORTING
MODE_VBAK = 'X'
VBELN = PF_VBELN
EXCEPTIONS
FOREIGN_LOCK = 2
SYSTEM_FAILURE = 3.
2015 Jul 16 8:36 AM
Hi
I have tried with MODE, Its not keeping the lock object active after closing the session.
Thanks
Arjun
2015 Jul 16 12:05 PM
Dear Arjun,
Try to use 'Commit' After locking.
Or
Try with custom lock.
Regards
Ravi