0% found this document useful (0 votes)
456 views

Create Authorization Object SAP

This document provides steps to create an authorization object and check it in a program to determine which centers a user has access to. It involves: 1. Creating an authorization class and object with fields like WERKS and ACTVT. 2. Adding the authorization object to a role and assigning the role to a user. 3. Creating a sample program to test the authorization object using AUTHORITY-CHECK and check if user has read access to specified center.

Uploaded by

carmen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
456 views

Create Authorization Object SAP

This document provides steps to create an authorization object and check it in a program to determine which centers a user has access to. It involves: 1. Creating an authorization class and object with fields like WERKS and ACTVT. 2. Adding the authorization object to a role and assigning the role to a user. 3. Creating a sample program to test the authorization object using AUTHORITY-CHECK and check if user has read access to specified center.

Uploaded by

carmen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

HOW TO?

CREATE AN AUTHORIZATION
OBJECT & CHEKIN PROGRAM.
RESUME OF THE DOCUMENT.
I want to determine which centers have allowed to use with my user. To do
this I have to create an authorization object and this object add to a role
manually and assign to my user. In this document I show haw to do this step
by step.

Step 1. In transaction SU20 - Create a Field authorization if its necessary


in this case i do not need. because I am going to use the field WERKS that
is created in sap yet.

Step 2. In transaction SU21 - Create a new Class of authorization . in this


case, I have created ZCEN and inside this class create an object
authorization in this case Z_WERKS.

2.A Create Object Class.

2.B inside the class create Authorization Object. in the authorization Object
we must indicate the authorization fields. WERKS and ACTVT to indicate the
activities allowed to the user.

- AUTHOROZATION OBJECT

- ACTIVITIES ALLOWED

Step 3. In transaction PFCG - Create a Role and add the authorization


Object and indicate the values.
Click on Modify Data .

Add manually the authorization Object Z_WERKS created on step before.

Step 4. Create the program as seen below to test the Authorization.


REPORT zauth_check_demo.
DATA: wa_t001w TYPE t001w.
PARAMETERS: p_werks TYPE werks_d.
AUTHORITY-CHECK OBJECT 'Z_WERKS'
ID 'ACTVT' FIELD '03'
" read access

ID 'WERKS' FIELD p_werks. " actual value


IF sy-subrc EQ 0. " check authorization
* fetch record
SELECT SINGLE * FROM t001W INTO wa_t001W
WHERE WERKS EQ p_werks.
WRITE:/ wa_t001w-werks,
wa_t001w-name1,
wa_t001w-kunnr,
wa_t001w-lifnr,.
ELSE.
WRITE:/ 'Bad Authorization'.
ENDIF.

You might also like