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

Authorization Check Field Name

Former Member
0 Likes
2,482

Hi,

Do we need to specify all field names when coding authorization check in abap?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,504

Hi,

if u want only two fields to be checked out of three in auth object,u can give the third one as DUMMY..

like dis

AUTHORITY-CHECK OBJECT 'F_BAV_BUK'

ID 'BUKRS' FIELD DUMMY

ID 'GSART' FIELD v_gsart

ID 'ACTVT' FIELD 02.

Hi,

Do we need to specify all field names when coding authorization check in abap?

4 REPLIES 4
Read only

Former Member
0 Likes
1,504

Hi,

Well that would depend on the requirement. If a authztn object has 2 fields plant & material no.

If you need authz only for plant then no need to pass any value for material no.

Best regards,

Prashant

Read only

Former Member
0 Likes
1,505

Hi,

if u want only two fields to be checked out of three in auth object,u can give the third one as DUMMY..

like dis

AUTHORITY-CHECK OBJECT 'F_BAV_BUK'

ID 'BUKRS' FIELD DUMMY

ID 'GSART' FIELD v_gsart

ID 'ACTVT' FIELD 02.

Read only

Former Member
0 Likes
1,504

Hi,

Check this.

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.

The number of fields you need to pass depends according to your requirement

Read only

Former Member
0 Likes
1,504

Hi,

Plz go through this...

AUTHORITY-CHECK OBJECT object

ID name1 FIELD f1

ID name2 FIELD f2

...

ID name10 FIELD f10.

Explanation of IDs:

object Field which contains the name of the object for which the authorization is to be checked.

name1 ... Fields which contain the names of the name10 authorization fields defined in the object.

f1 ... Fields which contain the values for which the f10 authorization is to be checked.

AUTHORITY-CHECK checks for one object whether the user has an authorization that contains all values of f (see SAP authorization concept).

You must specify all authorizations for an object and a also a value for each ID (or DUMMY ).

The system checks the values for the ID s by AND-ing them together, i.e. all values must be part of an authorization assigned to the user.

If a user has several authorizations for an object, the values are OR-ed together. This means that if the CHECK finds all the specified values in one authorization, the user can proceed. Only if none of the authorizations for a user contains all the required values is the user rejected.

If the return code SY-SUBRC = 0, the user has the required authorization and may continue.

The return code is modified to suit the different error scenarios.

The return code values have the following meaning:

4 User has no authorization in the SAP System for such an action. If necessary, change the user master record.

8 Too many parameters (fields, values). Maximum allowed is 10.

12 Specified object not maintained in the user master record.

16 No profile entered in the user master record.

24 The field names of the check call do not match those of an authorization. Either the authorization or the call is incorrect.

28 Incorrect structure for user master record.

32 Incorrect structure for user master record.

36 Incorrect structure for user master record.

If the return code value is 8 or possibly 24, inform the person responsible for the program. If the return code value is 4, 12, 15 or 24, consult your system administrator if you think you should have the relevant authorization. In the case of errors 28 to 36, contact SAP, since authorizations have probably been destroyed.

Individual authorizations are assigned to users in their respective user profiles, i.e. they are grouped together in profiles which are stored in the user master record.

Instead of ID name FIELD f , you can also write ID name DUMMY . This means that no check is performed for the field concerned.

The check can only be performed on CHAR fields. All other field types result in 'unauthorized'.