TCODE SE80
Name: Z_EMP_ID00
Field Label属性
|
Length |
Field Label |
Short |
10 |
ID |
Medium |
15 |
EMPLOYEE ID |
Long |
20 |
EMPLOYEE EMPLOYEE ID |
Heading |
19 |
EMPLOYEE ID HEADING |
Name |
Z_EMP_ID00 |
Data Type |
NUMC |
No. Characters |
10 |
Decimal Places |
0 |
Output Length |
10 |
TCODE SU20
Field Name |
ZEMPID00 |
Data element |
Z_EMPID00 |
多个Authorization Fields是被归在一个Authorization Object中的,创建好Object后需要把Z_EMPID00 assign给它.
TCODE SU21
图SU21-1 (SU21界面)
Object Class |
ZEMP |
Text |
Empleyee Object class. |
Object |
ZEMPOBJ00 |
Text |
Employee object 00. |
Field name |
ZEMPID00 |
图SU21-2 (创建Authorization Object)
图SU21-3 (Object Class和Authorization Object创建完毕)
这个Profile包含用户对Object ZEMPOBJ00的各个Field有权限访问的具体范围.
TCODE SU01
在菜单Enviroment > Mainten Profile(F9)
Profile: ZEMPRF00
选择Create.
图SU01-1 (创建Profile)
在下半部分的表格中的Object列中添加ZEMPOBJ00
Save, 激活
Authorization列输入ZAHUEMP,双击新建它
Text: Authorization for Employee.
点击Maintenance Value, 在From列和To列分别输入*
分别激活Authorization, Profile.
图SU01-2 (Profile 创建完毕)
然后回到SU01对BCUSER的界面, 在Profile面板:
添加ZEMPRF00
Save.
TCODE PFCG
Role ZEMPR
选择Single Role
在Authorizations面板中:
Profile Name |
ZEMPRF00 |
Profile Text |
Employee Profile |
在User面板中:
User: BCUSER
REPORT ZAUTHORITY01.
DATA: Z(20) VALUE 'abc'.
AUTHORITY-CHECK OBJECT 'ZEMPOBJ00'
ID 'ZEMPID00' FIELD Z.
WRITE:/ Z.
IF SY-SUBRC = 0.
WRITE:/ 'PASS'.
ELSE.
WRITE:/ 'Sorry.'.
ENDIF.
用户BCUSER必须先退出系统然后登录后前面设置的role才会生效.运行程序,结果为PASS.