Posted: Thu Aug 14, 2008 7:54 pm Post subject: Проверка объекта на блокировку ФМ ENQUEUE_READ
Проверка блокированности объекта с помощью ФМ ENQUEUE_READ. Запускaется после commit work and wait для для подтверждения, что модифицированные объекты изменены и доступны для последующего изменения (как правило update в цикле).
Заблокированные объекты можно посмотреть в sm12 перед запуском commit work.
Code:
FUNCTION z_w_wf_mminvoice_check_lock.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(I_BELNR) TYPE RBKP-BELNR
*" VALUE(I_GJAHR) TYPE RBKP-GJAHR
*" VALUE(I_MAX_COUNT) TYPE I DEFAULT 30
*" VALUE(I_INTERVAL) TYPE I DEFAULT 2
*" EXCEPTIONS
*" TIME_EXCESS
*" INCORRECT_DATA
*"----------------------------------------------------------------------
*************
DATA: l_garg LIKE seqg3-garg,
lt_enq LIKE seqg3 OCCURS 1 WITH HEADER LINE,
l_ebeln TYPE rseg-ebeln,
l_lock.
IF i_belnr IS INITIAL OR
i_gjahr IS INITIAL.
RAISE incorrect_data.
ENDIF.
SELECT SINGLE ebeln INTO l_ebeln
FROM rseg
WHERE belnr = i_belnr
AND gjahr = i_gjahr.
DO i_max_count TIMES.
CLEAR l_lock.
REFRESH lt_enq.
CONCATENATE sy-mandt i_belnr i_gjahr INTO l_garg.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
gname = 'RBKP'
garg = l_garg
guname = sy-uname
TABLES
enq = lt_enq
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL OR NOT lt_enq[] IS INITIAL.
l_lock = 'X'.
ENDIF.
IF l_lock IS INITIAL.
REFRESH lt_enq.
CONCATENATE sy-mandt l_ebeln INTO l_garg.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
gname = 'EKKO'
garg = l_garg
guname = sy-uname
TABLES
enq = lt_enq
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL OR NOT lt_enq[] IS INITIAL.
l_lock = 'X'.
ENDIF.
ENDIF.
IF l_lock IS INITIAL.
REFRESH lt_enq.
CONCATENATE sy-mandt l_ebeln '*' INTO l_garg.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
gclient = sy-mandt
gname = 'EKPO'
garg = l_garg
guname = sy-uname
TABLES
enq = lt_enq
EXCEPTIONS
communication_failure = 1
system_failure = 2
OTHERS = 3.
IF NOT sy-subrc IS INITIAL OR NOT lt_enq[] IS INITIAL.
l_lock = 'X'.
ENDIF.
ENDIF.
IF NOT l_lock IS INITIAL.
WAIT UP TO i_interval SECONDS.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFUNCTION.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.