‎2007 Sep 04 12:35 PM
Hello expert.
below is my requirement.
while count <> 0.
do some processing to fill wa_tab.
append wa_tab to i_tab.
endwhile.
modify db_tab from table i_tab.
Now i want to lock records at the time of update database record.
please let me which one of below code is right and gud in performance.
1.
while count <> 0.
do some processing to fill wa_tab.
append wa_tab to i_tab.
lock entry in wa_tab. using lock object.
endwhile.
modify db_tab from table i_tab.
loop at i_tab into wa_tab.
unlock entry of database entry using wa_tab
endloop.
2.
while count <> 0.
do some processing to fill wa_tab.
append wa_tab to i_tab.
endwhile.
lock the comple table
modify db_tab from table i_tab.
unlock complete table.
please add something if it is required and not there in the above pseudo code
thanks in advance for ur valuable help.
‎2007 Sep 04 12:42 PM
Hi,
In the First step also, lock the complete table
Regards
Sudheer
‎2007 Sep 04 1:11 PM
Hi,
In this case you can use the F.Ms ENQUEUE and DEQUEUE
while count <> 0.
do some processing to fill wa_tab.
append wa_tab to i_tab.
endwhile.
<b>CALL FUNCTION 'ENQUEUE_EXXXX'</b>
modify db_tab from table i_tab.
if sy-subrc = 0.
write : 'Records are succ updated'.
endif.
<b>CALL FUNCTION 'DEQUEUE_EZVIJ'</b>
Suppose if ur updating Z-table check whether lock objects has created or not, if not you can create the lock object by using SE11.
<b>Reward with points if useful.</b>
Regards,
Vijay
‎2007 Sep 04 1:58 PM
Do not locfk the complete table! Always lock only as little as necessary. Sooner or later you want to run your programm in parallel (multi-user), then the locking of the complete table will stop the second user.
Use insert or update if possible, and modify only if you do not know whether records exist already!
Siegfried
‎2007 Sep 04 2:08 PM
Theoretically do something like
* Fill table when locking records
LOOP.
" some processing
PERFORM lock record. " ENQUEUE
" some processing again
APPEND record TO update_table.
ENDLOOP.
* Call in update task a Function Module (just UPDATE from table in it)
CALL FUNCTION 'Zupdate' IN UPDATE TASK
table
update_table = update_table.
* Validate
COMMIT WORK. " don't wait,
* the task will update data and release locksRegards<i></i>