05-19-2011 12:32 PM
hi,
is it possible to 'lock' an table for a specific time ?
i have a Z-table where rows are inserted all the day.
3 times a day i have to read the table and send data to another system.
is it possible to 'lock' a table , so that only this program can exclusivly use it ? so that
the other places where there is a insert into table have to wait until table is unlocked again ?
i don't want to be rows inserted during the programm runs 3 times a day.
reg, Martin
05-19-2011 12:49 PM
Hi ,
You can do it. The Lock Objects are created in SE11 with naming standard EZ.
whenever you create a Lock Object a FM is generated.
Now call the ENQUEUE by passing the paramerter as required and then Dequeue it.
For example: My Ztable is ZARS_TRHDR_T'
CALL FUNCTION 'DEQUEUE_EZARS_TRHDR_T'
EXPORTING
iface = pv_iface
idate = pv_idate
itime = pv_itime.
Similarly for ENQUEUE. Hope This Helps.
Thanks,
Bhargav
05-19-2011 12:40 PM
No problem, if the "other places" are properly setting locks while updating the table. Then your sender program can try to set the lock, if successful then process the data, if not successful wait until the lock has been released (the "other places" should use a similar logic).
Read further about SAP lock concept.
Thomas
05-19-2011 12:49 PM
Hi ,
You can do it. The Lock Objects are created in SE11 with naming standard EZ.
whenever you create a Lock Object a FM is generated.
Now call the ENQUEUE by passing the paramerter as required and then Dequeue it.
For example: My Ztable is ZARS_TRHDR_T'
CALL FUNCTION 'DEQUEUE_EZARS_TRHDR_T'
EXPORTING
iface = pv_iface
idate = pv_idate
itime = pv_itime.
Similarly for ENQUEUE. Hope This Helps.
Thanks,
Bhargav
05-19-2011 12:54 PM
hi v s,
when calling the 2 FM, is there anything i should do with the parameters iface, idate and itime, which
are export parameters ? how to fill it ?
can i be sure that other programs 'wait' until the table is unlocked again ?
b. reg, Martin
05-19-2011 2:40 PM
when calling the 2 FM, is there anything i should do with the parameters iface, idate and itime, which
are export parameters ? how to fill it ?
can i be sure that other programs 'wait' until the table is unlocked again ?
Those are key fields specific to the table in the example. If you want the programs to 'wait', you have to use the built-in function parameter or program the wait in a loop yourself. Check the help files on ENQUEUE as Thomas has already suggested.