2013 Nov 24 5:43 AM
Hi,
I got a scenario where module pool is not working correctly while simultaneously multiple users run that program. How can i know while code execution that the program is already opened. I dont think ABAP memory works is there any other efficient way for this please share your suggestions...
Hi abilash,
If you want to know if the application is used by another user then you can use the concept of lock objects. This will allow only one user to work in the application one at a time and other user's will not be allowed to work in it . The lock is done by enqueue and after processing Dequeue takes place.
Once the dequeue is successful then next user can work with the application.
Refer : SAP Lock Concept (SAP Library - The SAP Lock Concept (BC-CST-EQ))
Regards,
Sivaganesh
2013 Nov 24 8:10 AM
2013 Nov 24 8:27 AM
Dear Abhilash,
first of all want to know, what is going wrong when multiple users executes that program? Is it related to Database tables? Then you may have to look for different strategy.
However, if you want to stop, then look for current users logged in and filter by who uses the tcode. (you can get this information0). If so then stop it by a message.
Regards,
Venkat
2013 Nov 25 1:07 AM
Hi,
Use shared memory object to store users, and check for that users in programme.
Regards,
Sreenivas.
2013 Nov 25 4:28 AM
Hi,
You can check the SM12 to view the list of users working on the which transactions and programs.
Pragmatically you can use the lock objects.
2013 Nov 25 5:14 AM
Simply use the concept of Lock objects.. The moment you enter a tcode to edit one record you call enqueue function module to lock that entry so that other person shall not edit it in parallel.
2013 Nov 25 5:27 AM
Hi Abilash,
If your module pool program updates a DB table, and the update is not working properly - lock object is your solution.
Otherwise, when the program starts, put a flag variable in global memory (using EXPORT, or you can use a function group for this purpose). And before that, IMPORT that flag and check if it is set, if yes, don't proceed further saying 'This t-code is already being run by someone else!'.
Hope this make sense! Cheers.
2013 Nov 25 5:46 AM
Hi abilash,
If you want to know if the application is used by another user then you can use the concept of lock objects. This will allow only one user to work in the application one at a time and other user's will not be allowed to work in it . The lock is done by enqueue and after processing Dequeue takes place.
Once the dequeue is successful then next user can work with the application.
Refer : SAP Lock Concept (SAP Library - The SAP Lock Concept (BC-CST-EQ))
Regards,
Sivaganesh
2013 Nov 25 7:29 AM
Hi Abhi,
DATA : lt_seqg3 TYPE STANDARD TABLE OF seqg3,
wa_seqg3 TYPE seqg3,
gv_name TYPE seqg3-gname.
gv_name = sy-repid.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
* gname = 'TRDIR'
* GARG = ' '
guname = '*'
* LOCAL = ' '
* FAST = ' '
* IMPORTING
* NUMBER =
* SUBRC =
TABLES
enq = lt_seqg3
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF lt_seqg3[] IS NOT INITIAL.
LOOP AT lt_seqg3 INTO wa_seqg3 WHERE garg CS gv_name.
IF wa_seqg3 IS NOT INITIAL.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CHECK wa_seqg3 is NOT INITIAL.
WRITE : wa_seqg3-garg.
Thanks & Regards,
Raghunadh Kodali.
2013 Nov 25 9:01 AM
Hi Guys,
Thanks for replies. I cant use Lock objects because the transaction is of moving the Stock from one storage bin to other storage bin. Each user will have individual pull list. But the 'n' no of pull list can have a common material,storage type and storage bin. If i keep lock objects that will effect all other users using material,storage type and storage bin.
2013 Nov 25 9:34 AM
Hi abilash n
You can try like this
if tcode already in use it trigger error message...
DATA : v_opcode(1) TYPE x,
wa_tcode TYPE usrinfo.
DATA: BEGIN OF usr_tcode OCCURS 10.
INCLUDE STRUCTURE usrinfo.
DATA: END OF usr_tcode.
CONSTANTS: opcode_list LIKE v_opcode VALUE 2.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_list
ID 'TABUSR' FIELD usr_tcode-*sys* .
READ TABLE usr_tcode INTO wa_tcode with key tcode = 'SE38'.
if wa_tcode is not INITIAL.
message : 'Already in Use' type 'E'.
endif.
break-point.
2013 Nov 25 9:40 AM
Then on what basis you want to prevent multiple user from executing the tcode.
2013 Nov 25 10:59 AM
Nabheet its by Material,storage bin,storage type. Is there any other way than Lock objects......
2013 Nov 25 11:28 AM
Please do as Ramesh suggested in previous post. SM04 shows us the detail who is doing what
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |