Posted: Wed Dec 19, 2007 4:59 pm Post subject: Как определить, что транзакция запущена в режиме изменения
Добрый день!
Мне нужно знать, что транзакция не запущена каким-нибудь пользователем в режиме изменения. Например, va02 cо сбытовым ордером 1234. Существует ли како-нибудь FM?
Age: 46 Joined: 05 Nov 2007 Posts: 725 Location: КраснАдар
Posted: Wed Dec 19, 2007 5:11 pm Post subject:
Можно попробывать вызвать ФМ SD_SALES_DOCUMENT_ENQUEUE с номером сбытового заказа - если кто-то уже обрабатывает придет ексепшн FOREIGN_LOCK. Ну а если нет - не забудьте перед обработкой сделать unlock.
Age: 160 Joined: 04 Oct 2007 Posts: 1218 Location: Санкт-Петербург
Posted: Wed Dec 19, 2007 10:06 pm Post subject:
Присоединяюсь к John Doe.
Еще варианты:
Rich Heilman wrote:
You might want to try using the fucntion module ENQUEUE_READ or you could use the lock object for sales documents, the function module to try to lock is ENQUEUE_EVVBAKE. You could call this and if there is a lock, it will tell you, if there is not a lock, you can quickly release the lock which as just created by the ENQUEUE_EVVBAKE function module and then call your BAPI.
Regards,
Rich Heilman
Quote:
You can use the FM ENQUEUE_READ function module..
Give the user name..
In the parameter
GUNAME - GIve the user ID.
GNAME - VBAK
In the ENQ internal table you will have a list of sales orders that the user is using in VA02.
Code:
DATA: GARG LIKE SEQG3-GARG,
ENQ LIKE SEQG3 OCCURS 1 WITH HEADER LINE.
REFRESH ENQ.
CONCATENATE sy-mandt vbeln INTO GARG.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
GCLIENT = SY-MANDT
GNAME = 'VBAK'
GARG = GARG
GUNAME = SPACE
TABLES
ENQ = ENQ
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
READ TABLE ENQ INDEX 1.
IF SY-SUBRC = 0.
MESSAGE S042(V1) WITH vbeln RAISING ERROR_IN_COPY.
ENDIF.
Quote:
For this you need to create Lock Object from se11 .It will automatically create Two Function modules for enque and deque.
In you case If you want to see the Details for VA02 use.
Code:
CALL FUNCTION 'ENQUEUE_EVVBAKE'
EXPORTING
VBELN = VBELN "Sales order
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
CASE SY-SUBRC.
WHEN 1.
MESSAGE E042(V1) WITH vbeln RAISING ERROR_IN_COPY.
ENDCASE.
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.