Application Development 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: 

hi all, want to know the purpose of authority check and lock object

Former Member
0 Kudos

hi all

i would like to know the significance of authority check and lock object in reports or in module pool.

if coding is provided along with this that would be very nice of you.

thanking u in advance

7 REPLIES 7

former_member181962
Active Contributor
0 Kudos

Authoroty cehck is to restrict a a set of user only to execute an application.

Eg:

PARAMETERS carr TYPE spfli-carrid.

AT SELECTION-SCREEN.

AUTHORITY-CHECK OBJECT 'S_CARRID'

ID 'CARRID' FIELD carr

ID 'ACTVT' FIELD '03'.

IF sy-subrc <> 0.

MESSAGE 'No authorization' TYPE 'E'.

ENDIF.

A lock object is used to lock an object to avoid potential Deadlock situations.

http://help.sap.com/saphelp_erp2005/helpdata/en/64/25738897a111d5b6ec006094192fe3/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21eea5446011d189700000e8322d00/frameset.htm

Former Member
0 Kudos

example:

You have two users each belonging to two different plant, if they were to execute a report which pulls out contract data, you wouldnt want user of plant1 to see the contract data of plant2. So authorization can be set to these users depending on the user profile set, so that one particular user can view only the data that he is supposed to.

Lock object: This is like if i have opened a delivery 1000 of of sales order 0001 in change mode, i cannot open the sales order 0001 in change mode, in the sense the sales order is locked. So we define lock ojbects in order that there is consistency in the data that is being written into the database, SOrry i can go on, but i would like to stop at this point.

Former Member
0 Kudos

The Authority check statement is used to ensure that the user has access to whatever function (create, edit, delete, etc)that is about to be performed. An error message will be issued and the user prevented from access if the authority check fails.

Lock objects, on the other hand, are used to ensure that an object is edited only by one person at a time, so as to avoid conflicts by multiple users updating/deleting at the same time. A "lock" is normally created on a database table, and it "locks" that particular record (primary key sequence) till the user is finished with the same, and exits the transaction.

Look at the following examples from SAP help:

http://help.sap.com/saphelp_nw04/helpdata/en/4f/991f82446d11d189700000e8322d00/frameset.htm

Sudha

abdul_hakim
Active Contributor
0 Kudos

Hi Raj,

<b>Authority check</b> is used to check whether a user has particular authorisation to perform certain action for eg executing certain transaction.

<b>Lock object</b> is used to lock the corresponding object say for eg a record while you are performing any updates so that the others cannot be able to modify it unless you finish it.

For more details please check the knowledge pool http://help.sap.com

Regards,

Abdul

Former Member
0 Kudos

Hi ,

Authority check object are used to check for

user authorization for transaction.

authority-check

object 'S_TCODE' id 'TCD'

field 'SE38'.

Lock objects are used when database tables are

updated or records are inserted to prevent deadlock.

Example

use Function Module

DEQUEUE_E_TABLE

ENQUEUE_E_TABLE to lock table during updation

or insertion

Reward points If helpful

Regards,

Amole

else.

Regards

Amole

Former Member
0 Kudos

Authority checks are used

<b>to restrict the user to run certain transactions ,</b>

Authorization groups ate created in SE54 and assigned to user profile.

<b> to restict an user from entering values to input enabled fields</b>

Authorization objects are created in SU21 and this should be coded in the program

AUTHORITY-CHECK OBJECT 'ZTEST_AUTH'

ID 'ACTVT' FIELD '01'.

IF SY-SUBRC NE 0.

AUTHORITY-CHECK OBJECT 'ZTEST_AUTH'

ID 'ACTVT' FIELD '02'.

IF SY-SUBRC NE 0.

AUTHORITY-CHECK OBJECT 'ZTEST_AUTH'

ID 'ACTVT' FIELD '03'.

IF SY-SUBRC NE 0.

MESSAGE S001(ZZ) WITH TEXT-101.

LEAVE PROGRAM.

ENDIF.

ENDIF.

ENDIF.

Former Member
0 Kudos

Hi Raj,

Authority check :

This is to resist the user access to some functionalities. For example if you have table control in the module pool and want to give Insert access to some users and some users only can see the data. then you can restrict the users by Authirization check. To do that first we need to maintain authorization object and should assign to the users. Then using authority check we can resist the users.

Lock Object :

This is to lock the table, tcode..etc.Let us say we want to change the record in the table and someone is trying to delete it then it will create dead lock problem as both are trying to acces same record. So this can be solved using lock objects. to do that first need to create lock object in SE11 and using ENQUEUE/DEQUEUE funcs we can achieve this.

Hope this info is helpful.

Thanks & Regards,

Siri.

Message was edited by: Srilatha T