2014 Sep 08 6:15 AM
Hi All,
I have developed editable ALV which allows users to edit and delete records and save those changes in database.
Input is Company Code , Document Number and Fiscal Year.
Now I want to restrict multiple users trying to edit/delete records with same company code at a same time.
Example:
User A is editing records for company code 1250.
If User B tries to access for same company code 1250 at the same time, it should return an
error message saying “Table currently locked by User A”.
and also want to restrict the records if multiple users are trying to edit/delete the same record at
a same time,I should give an error message.
Thanks,
Arpita
2014 Sep 08 6:18 AM
I would simply populate the results in a maintenance view and use events to control editing..
2014 Sep 08 6:23 AM
thanks.
Can you pls explain in detail...
and I don't have authorization to use maintenance view in this case..
2014 Sep 08 6:30 AM
Hi,
Create one table and update the flag as per company code before update in the database check the flag is active then display error message. When user press back button deactivate the flag in table.
One drawback is there, if user explicitly close the session then we don't have event to deactivate the flag in database.
Regards,
Nishant
2014 Sep 08 6:48 AM
First perform some search on Lock Concept in online help (ABAP Programming (BC-ABA), The ABAP Programming Language, Saving Data Externally, Data Consistency, The SAP Lock Concept or The SAP Lock Concept (BC-CST-EQ), SAP Lock Concept)
Then use or create thru SE11 a lock object for your table (keys must start with mandt + Bukrs, to not interfere with standard locks, e.g. EFBKPF, you may create your own z-structure and an associated lock object) and before reading data check the company code is not yet locked with ENQUEUE FM, release the lock is either implicit at end of transaction or triggered thru DEQUEUE FM or COMMIT/ROLLBACK WORK (depends also on your choice on _SCOPE Parameter value).
Regards,
Raymond
2014 Sep 08 7:00 AM
Hi Arpita,
Can you use Lock objects for restrict users for same company code.
For EX:
if(companycode = ' ' )
enable lock object .
endif.
Please refer the below links or search in SDN or google.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
http://www.erpgreat.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Regards,
Lokeswar Reddy Byni.
2014 Sep 08 8:01 AM
2014 Sep 08 8:06 AM
2014 Sep 08 8:12 AM