Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP lock objects

alex_georgek
Associate
Associate
0 Likes
537

Hi All,

My requirement i as follows.I have a report where i transfer the master data from SAP to third party system.Also i have a view cluster or a view where i maintain the same master data.Now my requirement is if the user is in change mode for any of master data record(single record),my report should not allow the transfer for those records instead it should throw an error tht the view is in change mode.For this i created a lock object for the tables of the view,but it is not working.

Has anyone come across such situations.Sample code will be helpful.

Regards,

Alex.

1 ACCEPTED SOLUTION
Read only

samantak_chatterjee
Active Contributor
0 Likes
500

Hi Alex,

I have made a couple of assumptions for the following problem :

1. You are using a View to Maintain the Table ( A Custom Table )

2. By editing you mean modification of existing entries. ( Not Creation and Deletion ).

You need to create a SAP Lock Object based on the Table with the locking parameters which you need to lock the entries. The locking parameters generally comes from the Primary keys of the Table. Once the Lock has been created, automatically 2 function modules are generated. 1. ENQUEUE_<lockobjectname> 2. DEQUEUE_<lockobjectname>. You need to call these modules to effectively handle the locking.

In the Table Maintenance Generator, you have to use the Events. You can use the event 07 - Before correcting the contents of a selected field. Here you need to call your own module which will use the ENQUEUE Function Generated Lock Module to put a lock on the entry. Once the changes are performed, you need to call another event 08 After correcting the contents of a selected field which will release the lock.

In the report program, in the Table Loop, you need to check for each and every individual entries are locked or not. You need to use the same function module to check for the locking. Once the entry is found already locked, then you can raise an error message and stop that entry from being exported.

Hope you got my point. Let me know if you need any further details. You need to look after the performance also as you have mentioned that the table will contain Master Data.

Thanks,

Samantak.

2 REPLIES 2
Read only

brad_bohn
Active Contributor
0 Likes
500

If you could be more specific, that would be helpful. Is it a custom report? Is this master data maintenance with an existing lock object, i.e., why did you create a new lock object? I may be stating the obvious, but the existence of the lock itself does not prevent anything else from happening with that data. All other applications that access/maintain the data must also use the same lock object checks to maintain the data integrity. SAP uses a logical locking concept.

Read only

samantak_chatterjee
Active Contributor
0 Likes
501

Hi Alex,

I have made a couple of assumptions for the following problem :

1. You are using a View to Maintain the Table ( A Custom Table )

2. By editing you mean modification of existing entries. ( Not Creation and Deletion ).

You need to create a SAP Lock Object based on the Table with the locking parameters which you need to lock the entries. The locking parameters generally comes from the Primary keys of the Table. Once the Lock has been created, automatically 2 function modules are generated. 1. ENQUEUE_<lockobjectname> 2. DEQUEUE_<lockobjectname>. You need to call these modules to effectively handle the locking.

In the Table Maintenance Generator, you have to use the Events. You can use the event 07 - Before correcting the contents of a selected field. Here you need to call your own module which will use the ENQUEUE Function Generated Lock Module to put a lock on the entry. Once the changes are performed, you need to call another event 08 After correcting the contents of a selected field which will release the lock.

In the report program, in the Table Loop, you need to check for each and every individual entries are locked or not. You need to use the same function module to check for the locking. Once the entry is found already locked, then you can raise an error message and stop that entry from being exported.

Hope you got my point. Let me know if you need any further details. You need to look after the performance also as you have mentioned that the table will contain Master Data.

Thanks,

Samantak.