‎2008 Jul 14 2:24 PM
hi,
iam doing a module pool program in which i have to give the message to the user if another user is already processing an order number......
iam developing program for co13 tcode replica in which the selection screen has order number after giving that order number if i press enter or f8 it should go to another screen if the another user is not processing it....if another user processing that order number which i have provided in the screen then it should throw an error saying that order is locked by user ......
plz help me to resolve this.
points will be rewarded.
Regards,
Avinash.
‎2008 Jul 14 2:29 PM
Hi,
Use FM: ENQUEUE_ESORDER to lock your order number passed as parameter.
If sy-subrc eq 0, then your lock succeeds, else, it is locked by someone. The system will automatically display the message with the user name.
Regards,
Subramanian
‎2008 Jul 14 2:37 PM
Hello.
In the begining of your tcode, try to enqueue same object that CO13 does. For that use statement like this one (CO03):
CALL FUNCTION 'ENQUEUE_ESORDER'
EXPORTING
AUFNR = AUFNR
_SCOPE = P_SCOPE
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
CASE sy-subrc.
WHEN 1.
WRITE aufnr TO l_aufnr NO-ZERO.
WRITE sy-msgv1 TO l_user.
MESSAGE e046(vl) WITH l_aufnr l_user.
WHEN 2.
MESSAGE e047(vl).
WHEN OTHERS.
ENDCASE.
Regards.
Valter Oliveira.
‎2008 Jul 14 2:47 PM
‎2008 Jul 14 2:54 PM
Hi again.
Scope is '2' by default. It's a control of blocking process. Controls how the lock or lock release is passed to the update program.
You have the following options:
_SCOPE = 1: Locks or lock releases are not passed to the update program. The lock is removed when the transaction is ended.
_SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
_SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.
DON'T FORGET TO DEQUEUE after program execution.
To more info about SAP lock refer to:
http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm
Regards.
Valter Oliveira.