SAP权限对象的创建与使用

在SAP的权限管理范畴,authority object是一个极其重要的东西,要明白SAP如何实现权限控制的,必须理解authority object

简单来说,对于SAP的标准程序(一般都是由tcode控制),当用户运行该标准程序,程序首先会验证当前用户是否有运行当前tcode的权限,也就是用SU01察看当前用户是否有那么一个角色包含了s_tcode权限对象(当然该对象中tcode field列表里面要有当前程序的tcode)。 如果这关通过了,那么标准程序的首界面就打开了,除此之外在标准程序里面还有许多的权限检查,比如检查当前用户是否有修改界面值得权限。

下面演示一下我们如何创建权限对象,并且如何在自定义程序中使用。(转自于:http://www.richardsantos.net/2009/03/16/sap-how-to-create-and-use-the-authorization-objects-in-abap/ , 再次转载请注明出处)

 

Figure 1

Steps to create authorization field
1. Go to transaction code SU20
2. Click the create new button on the application toolbar.
3. Enter “ZTCODE” in the Field Name and “TCODE” in the Data Element, then hit Enter.
4. Click the save button on the system toolbar.

Next step is to create the authorization class(see #1 in figure 1) and authorization object(see #2 in figure 1).

Steps to create authorization class
1. Go to transaction code SU21
2. Click on the Create button’s drop down icon and select “Object Class”.
3. Enter “ZTRN” on the Object Class field.
4. Give it a description and save it.

Steps to create authorization object
1. Again in SU21, in the list of authorization class(folder icon), click the one that we’ve created(ZTRN).
2. Click on the Create buttodrop down, this time selecting “Authorization Object”.
3. Enter “Z_TCODE” on the Object field and give it a description.
4. On the authorization fields section, enter ACTVT and ZTCODE. ACTVT is used to set and limit the activity of the user, while the ZTCODE is the authorization field that we’ve created earlier which is
responsible for holding a list of tcodes.
5. On the Further Authorization Object Settings, click on “Permitted activities” button. Here we will select the specific activities that we want to be available for our authorization object.
6. As an example, we will select 01(Create), 02(Change), and 03(Display).
7. Save and Exit.

Now we’re done creating our own authorization object, let us now use and assign it to a user.

Steps to create a role(see figure 2)
1. Go to transaction code PFCG.
2. Enter “ZAUTHTEST” on Role field and click the “Single Role” button.
3. Now give it a description, click the save button and click the Authorization tab.
4. Click the “Change Authorization Data” button inside the authorization tab.
5. Then click the “Manually” button on the application toolbar and type in the name of the authorization object that we’ve created earlier(”Z_TCODE”) and press enter.
6. Expand all the nodes, double click on the input field of the Activity and select activity 01 and 02.
7. Enter the tcode of our own abap program in ZTCODE field, in our example I used “ZCOMM” .
8. And also don’t forget to add the S_TCODE authorization object and enter ZCOMM on it’s field.
9. Now Click on the Generate button in the application toolbar and press enter on the pop-up screen.
10. press the back button and assign a specific user on the user tab and click User Comparison button.
11. Now create another role by repeating steps 1 to 9 but this time select activity 03 on step 6.
12. Then assign this 2nd role to another user.

Figure 2
Figure 2

Now let’s implement this authorization in our ABAP program. Let say we have a dialog program(ZCOMM) wherein we have a button on the screen that when clicked, the user will go to the Create/Edit screen(1000) if he’s authorized. On the other hand, he will go to display only screen(2000) if he’s not authorized. To do that, simply add the code below on your program.

  AUTHORITY-CHECK OBJECT ‘Z_TCODE’    “authorization object that we’ve created
      ID ‘ACTVT’ FIELD ‘01′                        “Activity = 01, authorized to create
      ID ‘ZTCODE’ FIELD ‘ZCOMM’.            “tcodes that we wants to check for authorization
  IF sy-subrc EQ 0.
      CALL SCREEN 1000.        “The user is authorized to create
  ELSE.
      CALL SCREEN 2000.        “User is not authorized to create (Display only)
  ENDIF.

 

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: SAP STCODE是SAP系统中的一种特殊的权限对象。它用于控制用户访问SAP系统中的事务代码(Transaction Code,简称TCODE)的权限。与其他权限对象相比,STCODE权限对象的特点是: 1. 与具体的角色或职能无关:STCODE权限对象是基于事务代码的,与用户的角色或职能无关。例如,一个财务人员可能需要使用财务相关的事务代码,而一个销售人员可能需要使用销售相关的事务代码。因此,STCODE权限对象用于控制特定事务代码的访问权限,而不是控制某个角色或职能的权限。 2. 细粒度的权限控制:STCODE权限对象可以针对单个事务代码进行权限控制,使用起来非常灵活。例如,可以为某个用户开放某个事务代码的执行权限,而不开放其他事务代码的执行权限。 3. 使用范围较广:STCODE权限对象可以用于控制各种不同类型的事务代码的访问权限使用范围较广。例如,可以用于控制财务管理、销售管理、生产管理等各种不同 ### 回答2: SAP的STCODE权限对象与其他权限对象之间有几个关键区别。 首先,STCODE权限对象SAP系统特有的权限对象,用于控制对事务码(Transaction Code,简称T-code)的访问权限。STCODE权限对象可以限制用户对特定的T-code是否可执行或可维护。其他权限对象则可能涉及到对数据、功能和对象的访问权限控制,如表格、字段、报表等等。 其次,STCODE权限对象适用于全局范围的权限控制。即一旦给定用户被授予或拒绝了对特定T-code的访问权限,这个权限将适用于整个系统中的所有实例。而其他权限对象可能以不同的层次结构和范围进行控制,例如可以设置对特定数据集、组织结构或业务流程的访问权限。 另外,STCODE权限对象是一种基于角色的权限分配。通常,SAP系统中的权限管理是通过角色与用户关联来进行的,用户被分配到角色上,而角色拥有相应的权限。STCODE权限对象可以与角色的其他权限对象(如表格、字段等)进行组合和关联,以形成更全面的权限控制。 最后,STCODE权限对象可以与其他权限对象进行交叉验证和冲突检查。可以通过审查给定用户的所有权限对象,来确认是否存在冲突或重复的权限分配。这样可以在最大程度上保证系统中权限的一致性和安全性。 总结来说,SAP的STCODE权限对象与其他权限对象相比,具有T-code访问权限控制的特点,适用于全局范围的权限控制,基于角色的权限分配,并且可以进行交叉验证和冲突检查。 ### 回答3: SAP STCODE权限对象与其他权限对象的主要区别在于其作用范围和针对性。 首先,SAP STCODE权限对象是指在SAP系统中对事务码进行控制的对象。事务码是SAP系统中的一个标识,用于调用特定的功能或进入特定的应用程序。STCODE权限对象针对具体的事务码进行权限控制,可以限制某个用户或用户组对特定事务码的访问和执行操作的权限。 与之相比,其他权限对象如ACTVT(活动)权限对象和S_TCODE(事务码)权限对象提供了更广泛的权限控制。ACTVT权限对象用于控制对某个特定活动的权限,如创建、更改或删除操作。S_TCODE权限对象则可以用于控制对多个事务码的权限,通过将事务码组成一个范围,并对该范围进行权限管理。 此外,SAP STCODE权限对象还可以与其他权限对象进行组合使用,从而实现更精细的权限控制。例如,可以通过将S_TCODE权限对象和STCODE权限对象相结合,限制某个用户组对特定事务码的执行权限,并且只允许其执行特定的活动。 总的来说,SAP STCODE权限对象与其他权限对象的区别在于其具体作用范围和灵活性。STCODE权限对象主要用于对特定事务码的权限控制,而其他权限对象可以提供更广泛的权限控制功能。同时,不同的权限对象可以相互组合使用,以实现更细致的权限管理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值