SAP Lock Object

Source: Internet
Author: User

The lock object technology can be used to prevent concurrent operations on databases.

 

The last function of SE11 is to create a Lock Object. For example, to lock the created database table, the name can be "E" + Table name.

After the name is set, click Create, enter the short text (description) of the lock object, and select the name of the table to be locked in the tables option, then, select "E" (dedicated, accumulative) in the lock parameter below. After setting, a lock object is created. In the lock parameter option, all primary keys in the default table are lock parameters. You can delete unnecessary parameters as needed.

Then, in the program, call the call function 'enqueue _ ez1_infnr 'and call function 'dequeue _ ez1_infnr' to lock and unlock the function in the program, the first function is used to lock the database before the program operates the database, and the last function is used to release the lock after the program operates the database. The Code is as follows:

 

Call function 'enqueue _ ez1_infnr'

Exporting

Mode_z1_infnr = 'E'

Mandt = sy-mandt

Proname = p_maktg

* Idnrk =

Werks = p_werks

* X_proname =''

* X_idnrk =''

* X_werks =''

_ Scope = '2'

* _ Wait =''

* _ Collect =''

Exceptions

Foreign_lock = 1

System_failure = 2

Others = 3

.

If sy-subrc <> 0.

Uname = sy-msgv1.

Message s001 with 'user 'uname' is modifying the project of this factory: 'p_maktg.

Stop.

Endif.

 

Select zpesinfnr ....

...

 

Call function 'dequeue _ ez1_infnr'

Exporting

Mode_z1_infnr = 'E'

Mandt = sy-mandt

SAP Lock Object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.