on 2006 Apr 03 9:27 PM
Hi folks,
I am trying to know if it is possible to question the system to know if an object is locked or no ?
I can used ENQUEUE_xxxxx function and it would return a SY-SUBRC depending on the lock status of my object. But this will also lock the object. I just want to query whether the object is lock or not. Is there a Function/System Function that exist for such a thing.
My business case is an interface with a portal. Before going foward in a process they want to see if a certain PO is locked or not. They don't want to lock until the BAPI BAPI_PO_CHANGE is called because they say that they can't control the user using the portal. This will at least tell the user that the PO, that they are trying to modify via the portal, is currently being modified by another user. They still run the risk that when they save their modification, somebody else will have lock the PO but this is a risk that they are willing to take. This process is very questionnable !
I browsed around, I also debugged a Function ENQUEUE_xxxxx and I can see they are using the C_ENQUEUE system function but there is no documentation no where on it.
So to repeat my initial request, is there anyway to know if an object is lock or not without locking it using the ENQUEUE_xxxxx function ?
The other way would be to use an ENQUEUE followed right away by a DEQUEUE but I am wondering if there is a better way ?
They might change the process too but for now, I am stuck with that.
Thanks,
Pat
Try with FM 'ENQUEUE_READ', its result is a table with locks. Run it with parameter GUNAME initial.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peluka and Amit, the function module ENQUEUE_READ is indeed what I was looking for. Here the sample code:
*----
FUNCTION z_bapi_checkpolock.
*"----
*"
*"Local interface:
*" IMPORTING
*" VALUE(I_EBELN) TYPE EBELN
*" TABLES
*" TAB_LOG STRUCTURE ZIMM_LOG
*"----
DATA: l_garg LIKE seqg3-garg,
l_number LIKE sy-tabix,
l_itab_enq LIKE TABLE OF seqg3.
FIELD-SYMBOLS: <wa_enq> LIKE LINE OF l_itab_enq.
CONCATENATE sy-mandt i_ebeln
INTO l_garg.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
garg = l_garg
guname = ''
IMPORTING
number = l_number
TABLES
enq = l_itab_enq
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF l_number > 0.
LOOP AT l_itab_enq ASSIGNING <wa_enq>
WHERE gname = 'EKKO'
OR gname = 'EKPO'.
Analyze what you want to do with this.
ENDLOOP.
ENDIF.
ENDFUNCTION.
*----
Thanks,
Pat
Message was edited by: Pat Baillar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for all your answer. I will try out your answer and give Reward Points later on after my tryout.
Srivinas: The users from the portal are our suppliers, the user in our system are obviously from our company. We want to prevent user from the portal to start modifying PO's (text) if the PO is lock by one of our internal user. We do not necessary want to expose, who is modifying the PO. So for this reason, we want to block the PO (for modif on the portal) if somebody from our company is already modifying it. Of course we run in the chance of us locking the PO while the supplier is making a change. But this is a situation the business is willing to take. They just want to give them better chance that when the supplier click on SAVE, they have less chance of somebody (intern) modifying that PO.
Peluka and Amit: Looks good to me, sounds like this is the functionality I was looking for. I just didn't know about the GUNAME field. I will try it out and come back to distribute the reward.
Thanks for your answer. I will post the code here once I've done it, so other can use it(that portion only, the rest would bore you ;).
Pat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi pat,
1. since you are presently knowing
the use of ENQUEUE_XXXX,
u also know the LOCK Object in question.
(ie. lock object for PO)
2. ENQUEUE_READ
Use this FM
(U can test it in se37 directly)
3. Suppose PURCHASE Order
Number 4300000398
is LOCKED by some user.
4. And the Client is 300 (for eg.)
5. Then in this FM, pass parameters as :
GARG = 3004300000398 (client plus PO Number )
GUNAME = Blank
6. If this po is locked,
then in TABLES Parameter,
u will get the full information !
a) who locked it
b) at what time it was locked
c) by what tcode it was locked
d) etc etc.
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If your purpose of knowing whether an object is locked for editing or not is simply to tell the user, why are you even trying this complex way?
Let us say user A is editing the PO. Now user B calls for editing the same PO from your portal. When you do a call to ME22N, system will anyway tell that the object is locked, correct? So why is this not useful?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
11 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.