2016 Jun 02 11:51 AM
Hi folks,
I am uploading exchange rates in tcurr table by using bapi bapi_create_multiple.
but if end-user in logged in , then bapi throws an error 'Object requested is currently locked by user '.
to avoid this i am killing session with the help of fm TH_DELETE_USER.
But this fm is not responding in background.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
gname = gc_rstable
guname = ''
TABLES
enq = gt_enq
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
* Implement suitable error handling here
ENDIF.
SORT gt_enq STABLE BY gname.
READ TABLE gt_enq INTO gw_enq WITH KEY gname = gc_rstable
garg+0(5) = 'TCURR' BINARY SEARCH.
IF sy-subrc EQ 0.
gv_user = gw_enq-guname.
ENDIF.
CALL FUNCTION 'TH_DELETE_USER'
EXPORTING
user = gv_user
client = sy-mandt
tid = -1
* LOGON_ID = -1
EXCEPTIONS
authority_error = 1
OTHERS = 2
.
IF sy-subrc EQ 0.
*** Implement suitable error handling here
ENDIF.
please suggest what should i do??
Thanks,
Darshan
2016 Jun 02 12:29 PM
Could you elaborate on "But this fm is not responding in background." (this FM performs perfectly in background)
Also
Regards,
Raymond
2016 Jun 02 1:01 PM
Hi raymond,
Thank you reply.
i have written this code in an abap proxy.. which gets triggered from PI system..
so when it gets triggered user session is not getting killed.
because of which bapi is throwing an error.
FM enqeue_read gives the username who has locked the entry.
to read the username, i am comparing the first five letters of garg field.
After that i am passing the same in th_delete_user.
Thanks,
Darshan
2016 Jun 02 1:27 PM
Hi Raymond,
Below are all critical authorizations i found in su53.
SAP_ABAA
SAP_ABJA
SAP_ABNA
SAP_ABNN
SAP_ADMM
SAP_ALOG
SAP_ARZM
SAP_ASPA
SAP_ASPD
SAP_ASPT
SAP_AUAM
SAP_AUAS
SAP_AUPM
SAP_AUPS
SAP_AUUM
SAP_AUUS
SAP_CTBA
SAP_CTBC
SAP_CTBS
SAP_DEVD
SAP_DEVT.
** S_ADMI_FCD is not in the list.. can be this the reason??
Thanks,
Darshan
2016 Jun 03 5:35 AM
If you think it is an authorisation problem, then run your transaction with an authorisation trace on ST01, and check the results for a non-zero return code.
2016 Jun 03 7:09 AM
Or look at FM source, in most (all?) versions, the first statement is an authorization-check.
2016 Jun 02 1:26 PM
Hi,
Did you tested the same in foreground, i mean by creating any sample program for the same. If so its working properly in foreground then you need to check what values are passing when you are executing the in background by doing external debugging.
Regards,
Venu
2016 Jun 02 1:30 PM
Hi venu,
Thank you for replying.
Yes it is working fine in foreground. when i test it manually in sproxy tcode.
But when i trigger it from pi server it does not work.
Thanks,
Darshan
2016 Jun 03 3:45 AM
2016 Jun 03 7:31 AM
Hi,
I suggest you to put external breakpoint and debug, then what return code you getting from FM's.
If your return code (SY-SUBRC) is not "0", then look for the exception matching with your code to find what's the actual error.
Regards,
Venu
2016 Jun 03 11:55 AM
HI Venu,
For triggering data into system, basis team has created different user named as RFC_PIT130.
Type of this user B i.e. System. because of which external debugger is not hitting.
Thanks.
2022 Dec 13 11:21 AM
The question is quite old, but nevertheless the following hint might be helpful in similar cases:
You have to logout the user from all servers of a system: Call TH_SERVER_LIST and make a call of TH_DELETE_USER with the option DESTINATION <servername> for each of the servers. This also works in a background job. The standard uses this way in form KILL_LOCKING_USERS of report HFIUCPL0.
Kind regards,
Franz