‎2009 May 12 10:07 AM
Hi,
I have to write an ABAP program that will check if a particular transaction (for example tcode VA01) is running than it must close the transaction.
Please give me your inputs or sample code if possible.
Thanks for your suggestions.
--Sanjay
‎2009 May 12 11:32 AM
‎2009 May 12 11:53 AM
Thanks for your reply.
in both cases it can be applicable. I will try to make it for the same user as well as different user.
‎2009 May 12 12:08 PM
Hi Sanjay,
Please write the below code:
DATA: lt_user TYPE STANDARD TABLE OF uinfo,
lt_user_wa LIKE LINE OF lt_user.
*---- Get the list of logged users
CALL FUNCTION 'CNV_GET_USERS_LOGGED_IN'
EXPORTING
mode = '1'
TABLES
i_usr = lt_user.
IF NOT lt_user[] IS INITIAL.
LOOP AT lt_user INTO lt_user_wa.
IF lt_user_wa-tcode = 'VA01'.
LEAVE TO TRANSACTION ' '.
ENDIF.
ENDLOOP.
ENDIF.
Regards,
-Syed
‎2009 May 12 12:21 PM
I guess you need to close that session, the way done in Std transaction SM04
‎2009 May 12 12:23 PM
Hi Vivek,
Sorry, CNV_GET_USERS_LOGGED_IN FM will get the list of users logged in currently.
And we need to explicitly close this using LEAVE TO TRANSACTION ' '.
Regards,
-Syed.
Edited by: wahid hussain syed on May 12, 2009 1:23 PM
‎2009 May 12 12:34 PM
Thanks Sayed and Vivek for your valuable inputs.
Sayed, the function CNV_GET_USERS_LOGGED_IN does not exist but PRGN_GET_USERS_LOGGED_IN with different parameters.
Yes Vivek, I want to implement the SM04 end session functionality in my ABAP program.
Please keep posting your inputs. Thanks.
‎2009 May 14 6:48 AM
Hello Team,
There are no new updates on my query. Should I close the query without answered?
Please let me know if you have some information to share. Thanks.
--Sanjay
‎2009 May 14 6:51 AM
Look [here|https://www.sdn.sap.com/irj/scn/advancedsearch?query=th_delete_user&cat=sdn_all].
‎2009 May 14 6:54 AM
‎2009 May 14 3:07 PM
Sanjay,
Check with this how much it is going to help you out..
PARAMETERS: p_user LIKE sy-uname.
DATA: gt_user_info TYPE TABLE OF /sdf/user_context,
wa_uinfo LIKE /sdf/user_context.
START-OF-SELECTION.
CALL FUNCTION '/SDF/MON_USER_MEMORY'
TABLES
modes = gt_user_info.
CHECK NOT gt_user_info IS INITIAL.
LOOP AT gt_user_info INTO wa_uinfo WHERE uname EQ p_user.
IF wa_uinfo-tcode = 'VA01'.
CALL FUNCTION 'TRANSACTION_ABORT'
EXPORTING
transaction_id = transaction_id
EXCEPTIONS
OTHERS = 1.
EXIT.
ENDIF.
ENDLOOP.
Regards,
CK
‎2009 May 15 2:21 PM
Hi Chandan,
thanks for your reply.
I did not find /sdf/user_context. I am getting error on the same line.
Please tell me what the structure/table it is.
-Sanjay
‎2009 May 15 2:36 PM
Hi,
Just do BDC for SM04 so that in menu Edit->Set filter is chosed. Then select transaction and then set the value as VA01.Then execute and select all button and then delete.
If you did recording for it, you can delete the list of users accessing the tcode .
‎2009 May 25 9:44 AM
‎2012 May 14 3:33 PM
Hi Sanjay,
I also have the same requirement.
Can you please let me know how did you solve it.
Thanks in advance.
Thanks,
Sudheer
‎2012 May 15 1:38 PM
Hi,
You can use ecatt recording for the same and call using se38