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

authority check

Former Member
0 Likes
1,462

please tell me whts the use of the following piece of code???

perform authority_check using w_indir.

form authority_check using x_indir.

authority-check object 'S_DATASET'

id 'PROGRAM' field sy-repid

id 'ACTVT' field '33'

id 'FILENAME' field x_indir.

endform. " AUTHORITY_CHECK

please tell me whts the use of the following piece of code???

perform authority_check using w_indir.

form authority_check using x_indir.

authority-check object 'S_DATASET'

id 'PROGRAM' field sy-repid

id 'ACTVT' field '33'

id 'FILENAME' field x_indir.

endform. " AUTHORITY_CHECK

6 REPLIES 6
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,137

Hi,

perform authority_check using w_indir.

form authority_check using x_indir.

authority-check object 'S_DATASET'

id 'PROGRAM' field sy-repid

id 'ACTVT' field '33'

id 'FILENAME' field x_indir.

endform. " AUTHORITY_CHECK

This peice of code is to check if you have therequired authorization.

AUTHORITY-CHECK statement checks whether authorization is entered in the user master record of the current user or the user specified in user for the authorization object S_DATASET, and whether this authorization is sufficient for the request specified in the statement.

Regards,

Sesh

Read only

Former Member
0 Likes
1,137

This statement checks whether authorization is entered in the user master record of the current user ( sy-uname) for the authorization object entered in the field S_DATASET and whether this is sufficient for the request specified in the statement. A flat character-type field that contains the name of an authorization object is expected for S_DATASET.

With id1 ... id10, you must have at least one and can have a maximum of 10 authorization fields listed for the authorization object specified. With id1 ... id10, "flat", character-type fields are expected that contain the name of the authorization fields in uppercase letters. If an authorization field is specified that does not appear in the authorization object, no check can be executed and sy-subrc is set to 4. For each specified authorization field, you must specify with FIELD either a value to be checked in a flat, character-type field val1 ... val10 or the language element DUMMY.

Regards,

Pavan

Read only

Former Member
0 Likes
1,137

Hi

In general different users will be given different authorizations based on their role in the orgn.

We create ROLES and assign the Authorization and TCODES for that role, so only that user can have access to those T Codes.

USe SUIM and SU21 T codes for this.

Much of the data in an R/3 system has to be protected so that unauthorized users cannot access it. Therefore the appropriate authorization is required before a user can carry out certain actions in the system. When you log on to the R/3 system, the system checks in the user master record to see which transactions you are authorized to use. An authorization check is implemented for every sensitive transaction.

If you wish to protect a transaction that you have programmed yourself, then you must implement an authorization check.

This means you have to allocate an authorization object in the definition of the transaction.

For example:

program an AUTHORITY-CHECK.

AUTHORITY-CHECK OBJECT <authorization object>

ID <authority field 1> FIELD <field value 1>.

ID <authority field 2> FIELD <field value 2>.

...

ID <authority-field n> FIELD <field value n>.

The OBJECT parameter specifies the authorization object.

The ID parameter specifies an authorization field (in the authorization object).

The FIELD parameter specifies a value for the authorization field.

The authorization object and its fields have to be suitable for the transaction. In most cases you will be able to use the existing authorization objects to protect your data. But new developments may require that you define new authorization objects and fields.

http://help.sap.com/saphelp_nw04s/helpdata/en/52/67167f439b11d1896f0000e8322d00/content.htm

To ensure that a user has the appropriate authorizations when he or she performs an action, users are subject to authorization checks.

Authorization : An authorization enables you to perform a particular activity in the SAP System, based on a set of authorization object field values.

You program the authorization check using the ABAP statement AUTHORITY-CHECK.

AUTHORITY-CHECK OBJECT 'S_TRVL_BKS'

ID 'ACTVT' FIELD '02'

ID 'CUSTTYPE' FIELD 'B'.

IF SY-SUBRC <> 0.

MESSAGE E...

ENDIF.

'S_TRVL_BKS' is a auth. object

ID 'ACTVT' FIELD '02' in place 2 you can put 1,2, 3 for change create or display.

The AUTHORITY-CHECK checks whether a user has the appropriate authorization to execute a particular activity.

This Authorization concept is somewhat linked with BASIS people.

As a developer you may not have access to access to SU21 Transaction where you have to define, authorizations, Objects and for nthat object you assign fields and values. Another Tcode is PFCG where you can assign these authrization objects and TCodes for a profile and that profile in turn attached to a particular user.

Take the help of the basis Guy and create and use.

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
1,137

Hi,

Much of the data in an R/3 system has to be protected so that unauthorized users cannot access it. Therefore the appropriate authorization is required before a user can carry out certain actions in the system. When you log on to the R/3 system, the system checks in the user master record to see which transactions you are authorized to use. An authorization check is implemented for every sensitive transaction.

If you wish to protect a transaction that you have programmed yourself, then you must implement an authorization check.

This means you have to allocate an authorization object in the definition of the transaction.

For example:

program an AUTHORITY-CHECK.

AUTHORITY-CHECK OBJECT <authorization object>

ID <authority field 1> FIELD <field value 1>.

ID <authority field 2> FIELD <field value 2>.

...

ID <authority-field n> FIELD <field value n>.

The OBJECT parameter specifies the authorization object.

The ID parameter specifies an authorization field (in the authorization object).

The FIELD parameter specifies a value for the authorization field.

The authorization object and its fields have to be suitable for the transaction. In most cases you will be able to use the existing authorization objects to protect your data. But new developments may require that you define new authorization objects and fields.

Regards,

Prajith

Read only

Former Member
0 Likes
1,137
perform authority_check using w_indir.
form authority_check using x_indir.
authority-check object 'S_DATASET'
id 'PROGRAM' field sy-repid
id 'ACTVT' field '33'
id 'FILENAME' field x_indir.
endform. " AUTHORITY_CHECK 

<b>'S_DATASET' -></b> Consist of ACTVT & FILENAME 2 parameters . so

<b>'ACTVT' -></b>activity means ...

 " Read , Write  , Display  ..  NOT Authoprised

, to the File etc.

<b>'FILENAME' -></b> will have the Particular Object (File) .

Normally 'S_DATASET' Authoirasation will be checked in the Applcation server level data file fetching and uploading into the sap .

using Function Modules :

<b>1.OPEN_DATA_SET

2.UPLOAD ....AND

3.CLOSE_DATA_SET ..</b>

In the above 3 Function Modules while OPEN_DATA_SET the 'S_DATASET' will be called and checked for activity and file name .

reward points if it is usefull....

Girish

Read only

Former Member
0 Likes
1,137

Hi,

The main use of Authority Check is to give authorization to the specific users. If Authority check is not given any user can use the program or table.

Ex:- In the below example i am applying the authority check for the specific t_code.

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD'

FIELD c_tcode.

IF sy-subrc NE 0.

MESSAGE e000(38) WITH text-002.

ENDIF.

in the above example 'S_TCODE'is the Object name, ‘TCD’ is the object id and c_tcode is the field name which we have used in our program.

Reward points if it is useful....

Thanks & Regards,

Vasudeva Rao.