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,497

Hi All,

In my code below statement is written.

authority-check 'ZSND'

ID 'Action' value 'A'.

Please tell me, when should I use Authority check field 'ACTION' ? What are the possible values for it?

Pl help.

Hardik

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,411

Go to SE80. Change to Development Class and set your Development Class. Open the Authorization Object arrow. Find ZSND and double click on it. This will show you the values.

In some cases, a Domain is used to set the values and you may need to go that one step further once you identify the Domain.

Hi All,

In my code below statement is written.

authority-check 'ZSND'

ID 'Action' value 'A'.

Please tell me, when should I use Authority check field 'ACTION' ? What are the possible values for it?

Pl help.

Hardik

7 REPLIES 7
Read only

Former Member
0 Likes
1,411

PL help guys

Read only

Former Member
0 Likes
1,411

Hi,

AUTHORITY-CHECK OBJECT object

ID name1 FIELD f1

ID name2 FIELD f2

...

ID name10 FIELD f10.

Effect

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'.Example

Check whether the user is authorized for a particular plant. In this case, the following authorization object applies

Table OBJ : Definition of authorization object

M_EINF_WRK

ACTVT

WERKS

Here, M_EINF_WRK is the object name, whilst ACTVT and WERKS are authorization fields. For example, a user with the authorizations

M_EINF_WRK_BERECH1

ACTVT 01-03

WERKS 0001-0003

can display and change plants within the Purchasing and Materials Management areas.

Such a user would thus pass the checks

AUTHORITY-CHECK OBJECT 'M_EINF_WRK'

ID 'WERKS' FIELD '0002'

ID 'ACTVT' FIELD '02'.

AUTHORITY-CHECK OBJECT 'M_EINF_WRK'

ID 'WERKS' DUMMY

ID 'ACTVT' FIELD '01':

but would fail the check

AUTHORITY-CHECK OBJECT 'M_EINF_WRK'

ID 'WERKS' FIELD '0005'

ID 'ACTVT' FIELD '04'.

To suppress unnecessary authorization checks or to carry out checks before the user has entered all the values, use DUMMY - as in this example. You can confirm the authorization later with another AUTHORITY-CHECK .

Reward If helpfull,

Naresh.

Read only

0 Likes
1,411

Hi Naresh,

This is not helpful. I am specificaly looking for authorization field 'ACTION' and its possible values.

someone please help.

Hardik

Read only

Former Member
0 Likes
1,412

Go to SE80. Change to Development Class and set your Development Class. Open the Authorization Object arrow. Find ZSND and double click on it. This will show you the values.

In some cases, a Domain is used to set the values and you may need to go that one step further once you identify the Domain.

Read only

0 Likes
1,411

Hi,

My requirement is given below,

-


To Create an Authorization object for Name field of XD01.

Then to create a Field exit for the Name1 field and Use the Authorization object to restrict the users by throwing an error msg and also assign the Authorization Object to the Specified Users

-


I need to perform authority check on the field NAME1 present in the standard screen - customer master ( T.Code-XD02). Only certain users should be allowed to edit the field and others should be restricted.

I have created a field exit FIELD_EXIT_AD_NAME1 for the ADRC-NAME1 field.

Now inside this field exit i need to write the authority-check code.

I have created the authorisation object Z_KNA1_NAM for the field NAME1 using the SU20 and SU21.

For this scenario how do i write the authority-check code in my field exit?

Please help me on this issue asap.

Cheers,

P.S.Chitra

Read only

Former Member
0 Likes
1,411

Hi,

I am not sure that I have seen such an Authority check like yours before. But please check this two examples from my code

1)

DATA: BEGIN OF RAVKORG OCCURS 0,

SIGN LIKE P_VKORG,

LOW LIKE P_VKORG,

HIGH LIKE P_VKORG,

OPTION LIKE P_VKORG,

END OF RAVKORG.

LOOP AT P_VKORG.

RAVKORG-SIGN = P_VKORG-SIGN.

RAVKORG-LOW = P_VKORG-LOW.

RAVKORG-HIGH = P_VKORG-HIGH.

RAVKORG-OPTION = P_VKORG-OPTION.

APPEND RAVKORG.

ENDLOOP.

SELECT * FROM TVKO WHERE VKORG IN P_VKORG. "RAVKORG.

AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'

  • ID 'VKORG' FIELD TVKO-VKORG.

ID 'VKORG' FIELD TVKO-VKORG

ID 'VTWEG' FIELD 'DUMMY'

ID 'SPART' FIELD 'DUMMY'

ID 'ACTVT' FIELD 'DUMMY'.

IF SY-SUBRC <> 0.

MESSAGE E090(ZK).

EXIT.

ENDIF.

ENDSELECT.

2)

AUTHORITY-CHECK OBJECT 'V_VBRK_VKO'

ID 'VKORG' FIELD '4000'

ID 'ACTVT' FIELD ' '.

3)

REPORT demo_authorithy_check.

PARAMETERS pa_carr TYPE sflight-carrid.

DATA wa_flights TYPE demo_focc.

AT SELECTION-SCREEN.

AUTHORITY-CHECK OBJECT 'S_CARRID'

ID 'CARRID' FIELD pa_carr

ID 'ACTVT' FIELD '03'.

IF sy-subrc = 4.

MESSAGE e045(sabapdocu) WITH pa_carr.

ELSEIF sy-subrc <> 0.

MESSAGE e184(sabapdocu) WITH text-010.

ENDIF.

START-OF-SELECTION.

SELECT carrid connid fldate seatsmax seatsocc

FROM sflight

INTO CORRESPONDING FIELDS OF wa_flights

WHERE carrid = pa_carr.

WRITE: / wa_flights-carrid,

wa_flights-connid,

wa_flights-fldate,

wa_flights-seatsmax,

wa_flights-seatsocc.

ENDSELECT.

Black,

give points if it helps

Edited by: BlackMoses on May 21, 2008 1:03 PM

Read only

soumya_jose3
Active Contributor
0 Likes
1,411

Hi Hardik,

ZSND authorization object is your customized one and not a standard one. So the possible values vannot be suggested.

In order to view an authorization object go to tcode su21. There expand an authorization object say for eg: AAAB . Under that S_IMG_ACTV IMG: Authorization to perform functions in IMG.

Double click on S_IMG_ACTV IMG. Then click on permitted activites tab. There you can find the permitted activities for ACTVT field. Here the permitted activity is '02' (Change).

Similarly serach for your object.

Reward points if helps.

Regards,

Soumya.