Skip to Content
0
Jun 02, 2016 at 10:51 AM

TH_DELETE_USER not working in background mode

462 Views

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