01-15-2010 10:19 AM
Hi I have created 10 Shadow tables and will run the job which updates the data to main data base tables.
So i am creating Lock Objctects for the tables.
Out of 10 tables 8 tables have common key which Business Partner (Primary Key). DO i need to create separate lock object for each of these 8 tables or one lock object is enough.....
01-15-2010 10:26 AM
In a single lock object you can include the primary and secondary tables.
read the section secondary tables
link:[http://www.sapfans.com/forums/viewtopic.php?f=31&t=326603]
Edited by: Keshav.T on Jan 15, 2010 4:14 PM
01-15-2010 12:55 PM
Dear Chaitanya
Please find the below code
Add the following code in-order to create the table lock. This function module must be called before any
update takes place. If a lock has already been taken out it will display the appropriate message.
CALL FUNCTION 'ENQUEUE_EZ_ZTABLENAME'
EXPORTING
mode_ZTABLENAME = 'E'
mandt = sy-mandt
KEYFIELD1 = "Value
KEYFIELD2 = "Value
KEYFIELD3 = "Value
...
* X_KEYFIELD1 = ' '
* X_KEYFIELD2 = ' '
* X_KEYFIELD3 = ' '
...
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
* If exceptions are not used, message is displayed within FM
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Retrieve message displayed within Function Module
message id sy-msgid
type 'I'
number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
The following code will remove the lock for the specific table entries.
CALL FUNCTION 'DEQUEUE_EZ_ZTABLENAME'
EXPORTING
MODE_ZTABLENAME = 'E'
MANDT = SY-MANDT
mandt = sy-mandt
KEYFIELD1 = "Value
KEYFIELD2 = "Value
KEYFIELD3 = "Value
...
* X_KEYFIELD1 = ' '
* X_KEYFIELD2 = ' '
* X_KEYFIELD3 = ' '
...
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.
Thanks
Surendra P
01-27-2010 12:19 PM