‎2009 Apr 15 6:55 AM
Hi,
i have developed a module pool program with options like :
1. NEW ENTRY
2. DISPLAY
3. CHANGE
the requirement is if one user is in new entry / change mode for the particular day , system shud not allow them like in standard. Not locking TCode or Table.
can any one tell me how to do it.
Waiting for ur reply...
Regards,
Srinath
‎2009 Apr 15 12:56 PM
hi Srinath,
* to lock Cusrom transactions..
USe the Funtion module
* Locking the transaction in SM01
perform bit-set using tstc-cinfo 6.
call function 'RSAU_WRITE_SM01_LOG'
exporting
tcode = tstc-tcode "Your T-code
lock = 'X'.
if sy-subrc <> 0.
endif.
form bit-set using hexval type x
bitpos type p.
case bitpos.
when 8. if hexval o x80. else. hexval = hexval + x80. endif.
when 7. if hexval o x40. else. hexval = hexval + x40. endif.
when 6. if hexval o x20. else. hexval = hexval + x20. endif.
when 5. if hexval o x10. else. hexval = hexval + x10. endif.
when 4. if hexval o x08. else. hexval = hexval + x08. endif.
when 3. if hexval o x04. else. hexval = hexval + x04. endif.
when 2. if hexval o x02. else. hexval = hexval + x02. endif.
when 1. if hexval o x01. else. hexval = hexval + x01. endif.
when others.
endcase.
endform. "bit-set
Regards,
Prabhudas
‎2009 Apr 16 10:37 AM
Prabhu - please read the question - he's talking about record locking, not transaction locking!
Srinath - read the documentation on LUW, ENQUEUE, DEQUEUE.
matt
‎2009 Apr 16 11:02 AM
HI,
You will have to use the concept of lock objects. Check the repository for lock objects on the tables where data is being inserted. If these are customer tables (ztables) then in se11 select lock obkects and give a nmae starting with ez or ey. It will ask for the table on which locking is required and the type of lock -- shared, exclusive . Upon saving the object the system will automatically create 2 fumnction modules enqueue_lock obkject name and dequeue_lock object name. When ever your program calls the entry being worked upon call the enqueue FM and after saveing relaese the lock using dequeue FM.
Object EMMARAE is used to Lock MARA and MARM/MAKT exclusively.
It would have to FMs ENQUEUE_EMMARAE for locking and
DEQUEUE_EMMARAE for unlocking.
Hope this helps.
Regards,
Sachin