‎2009 Aug 28 10:11 AM
Hi ,
How to avoid multiple access to a transaction/program. I,e, if the transaction is running , then it should not allow running this code till the first is completed .
This should work across all the clients .
Thanks
Supriya
‎2009 Aug 28 10:14 AM
Hi,
maybe you can use the SAP Lock Concept:
http://help.sap.com/saphelp_nw04/helpdata/DE/7b/f9813712f7434be10000009b38f8cf/content.htm
Hope this helps.
Regards,
David
‎2009 Aug 28 10:14 AM
Hi,
maybe you can use the SAP Lock Concept:
http://help.sap.com/saphelp_nw04/helpdata/DE/7b/f9813712f7434be10000009b38f8cf/content.htm
Hope this helps.
Regards,
David
‎2009 Aug 28 10:20 AM
I think this normally works with a table .
How to use for programs and transaction ?
‎2009 Aug 28 10:26 AM
Hi,
you're right ! You can use it to lock access to all tables used in your Program.
Or you can create your own lock concept (i.e. with a Z* table with the Prog ID/User ID etc...)
Regards,
David
‎2009 Aug 28 10:34 AM
That depends upon the purpose u are using the particular tranaction or program
if the program directly impacts the table by changing the value or inserting the value it needs to be done by a enqueue and dequeue concept (i.e., by creating a lock object based on the primary.
so according it will prevent other transaction or table or program from prevent using it
with regards
s.janagar
‎2009 Aug 28 10:51 AM
But My transaction does not modify any table.
It is just a report.
How to avoid multiple access for a transaction/program
‎2009 Aug 28 10:52 AM
Hello Supriya,
I donot think you need an additional Z-table for this. You can use the IMPORT/EXPORT statements to achieve this.
Try something like this:
START-OF-SELECTION.
DATA:
BEGIN OF st_tcode,
tcode TYPE tcode,
flag TYPE flag,
END OF st_tcode.
DATA:
wa_indx TYPE indx,
v_flag TYPE flag.
IMPORT st_tcode = st_tcode
FROM DATABASE indx(tc)
TO wa_indx
CLIENT sy-mandt ID sy-tcode.
IF sy-subrc = 0.
CHECK st_tcode-tcode = sy-tcode.
v_flag = st_tcode-flag.
ENDIF.
IF v_flag IS INITIAL. "No other instance of tcode running
st_tcode-tcode = sy-tcode.
st_tcode-flag = 'X'.
EXPORT st_tcode = st_tcode
TO DATABASE indx(tc)
FROM wa_indx
CLIENT sy-mandt ID sy-tcode.
* Proceed Further Processing
ELSE.
* DONOT Proceed Further Processing
ENDIF.Hope i am clear.
BR,
Suhas
‎2009 Aug 28 11:43 AM
‎2009 Aug 28 11:45 AM
‎2009 Sep 03 6:31 AM
Hi Suhas ,
The solution which you gave works fine at the first instances , But sometimes behaves vaguely .
Can you give me any other solution ?
Thanks ,
Supriya .
‎2009 Sep 03 6:52 AM
Use this code. Hope this will work.
TABLES: UINFO.
DATA: BEGIN OF COMMON PART USR.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE USRINFO.
DATA: END OF USR_TABL.
DATA: END OF COMMON PART USR.
call 'ThUsrInfo' id 'OPCODE' field opcode_list
id 'TABUSR' field usr_tabl-*sys* .U will get value which user is runnign which TCODE, if ur tcode is not exit in table usr_tabl ,go ahead else dont allow.
‎2009 Sep 03 7:46 AM
Hi,
What is opcode_list .
I tried giving value 2 , but I am not getting all the sessions which are logged in.
Also , i get no values for id 'TABUSR' field usr_tabl-sys .
I had to change it to id 'TAB' field usr_tabl-sys . ;
but still no proper result
‎2009 Sep 03 8:02 AM
SORRY ABOUT THAT.
use this.
DATA: TH_OPCODE(1) TYPE X,
myname like msxxlist-name.
CONSTANTS: OPCODE_LIST LIKE TH_OPCODE VALUE 2.
call 'C_SAPGPARAM' id 'NAME' field 'rdisp/myname' " syetem
id 'VALUE' field myname.Edited by: KaushiK©Datta on Sep 3, 2009 12:32 PM
‎2009 Sep 03 8:08 AM
Hi , its still not working.
Please provide me the entire code
‎2009 Sep 03 8:15 AM
Hey I have written the same code in my system , its working fine here. Im pasting the code here, just have a look.
REPORT ZKD_USER.
TABLES: UINFO.
DATA: TH_OPCODE(1) TYPE X.
DATA: BEGIN OF COMMON PART USR.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE USRINFO.
DATA: END OF USR_TABL.
DATA: END OF COMMON PART USR.
CONSTANTS: OPCODE_LIST LIKE TH_OPCODE VALUE 2.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE_LIST
ID 'TABUSR' FIELD USR_TABL-*SYS* .
BREAK-POINT.
‎2009 Sep 03 8:23 AM
Hi Kaushik ,
I pasted the code which you gave but no result .
Also , I am getting syntax error USRINFO not found.
I am working on sap 4.7 .
Also , the ID TABUSR'' doesnt work , I have to use 'TAB' because of which i do get 3 sessions but not all.
Is there some config to be done ?
‎2009 Sep 03 9:25 AM
Ok , that might be the problem, Im using ECC6. Can u check the program for tcode SM04? There you can find the correct code there.