• ABAP—权限对象设计及权限检查


    0.例子

    建立一个ZTMM_TEST1,表中插入几条数据,实现只能操作部门10的数据。

     

     1.SU20,创建权限字段

     2.SU21,创建权限对象

      2.1先创建对象类ZCK.

     2.2在对象类中创建权限对象。

     

     3.SU02,创建参数文件,并激活

    维护权限值。

     

    4.SU01,为用户分配参数文件

     5.SE38,编写程序及效果

    REPORT ZMMR_CK_TEST2 .
    TABLES ZTMM_TEST1.
    DATA: IT_ZEMP TYPE STANDARD TABLE OF ZTMM_TEST1,
          IW_ZEMP TYPE ZTMM_TEST1.
    
    PARAMETERS P_DEPT TYPE ZTMM_TEST1-DEPT.
    
    START-OF-SELECTION.
    
    AUTHORITY-CHECK OBJECT 'ZEMPDEPT'
             ID 'DEPT' FIELD P_DEPT
             ID 'ACTVT'  FIELD '03'.
    IF SY-SUBRC <> 0.
      MESSAGE S001(00) WITH '您没有权限查看此数据' DISPLAY LIKE 'E'.
    ELSE.
    
    SELECT *
      FROM ZTMM_TEST1
      INTO TABLE IT_ZEMP
      WHERE DEPT = P_DEPT.
    
    LOOP AT IT_ZEMP INTO IW_ZEMP.
      WRITE / IW_ZEMP.
      ENDLOOP.
      ENDIF.
    View Code

    输入:20

     输入:10

     6.ACTVT及sy-subrc 返回值

    actvt的所有值储存在表TACT中。

    ----------------------------------------
    |  ACTVT|LTEXT                            |
    ----------------------------------------
    |  01   |创建或生成                         |
    |  02   |更改                                  |
    |  03   |显示                                  |
    |  04   |打印、编辑消息                    |
    |  05   |锁定                                  |
    |  06   |删除                                  |
    |  07   |激活,生成                          |
    |  08   |Display change documents  |
    |  09   |显示价格                             |
    |  10   |过帐                                   |
    |  11   |修改数值范围状态                  |
    |  12   |维护并生成修改文档               |
    |  13   |初始化数量级别                     |
    |  14   |字段选择: 生成屏幕                |
    |  15   |字段选择: 赋值表                   |
    |  16   |执行                                    |
    |  17   |维护编号范围对象                   |
    |  18   |从 coll. 程序交货                    |
    |  19   |coll. proc 的发票                   |
    |  20   |无翻译传输                           |
    |  21   |传输                                    |
    |  22   |输入,包括, 分配                     |
    |  23   |维护                                   |
    |  24   |归档                                   |
    |  25   |Reload                               |
    |  26   |修改客户帐号组                       |
    |  27   |Display totals records        |
    |  28   |显示行项目                         |
    |  29   |显示存储数据                        |
    |  30   |决定                            |
    |  31   |确认                            |
    |  32   |保存                            |
    |  33   |读                             |
    |  34   |写                             |
    |  35   |输出                            |
    |  36   |扩展维护                          |
    |  37   |接受                            |
    |  38   |完成                            |
    |  39   |检查                            |
    |  40   |在 DB 中创建                      |
    |  41   |在 DB 中删除                      |
    |  42   |转换到 DB                        |
    |  43   |释放                            |
    |  44   |标记                            |
    |  45   |允许                            |
    |  46   |Merge                         |
    |  47   |借位                            |
    |  48   |模拟                            |
    |  49   |请求                            |
    |  50   |移动                            |
    |  51   |Initialize                    |
    |  52   |修改应用程序开始                      |
    |  53   |显示应用开始                        |
    |  54   |显示应用档案                        |
    |  55   |修改应用程序归档                      |
    |  56   |显示档案                          |
    |  57   |保存档案                          |
    |  58   |显示接管                          |
    |  59   |分配                            |
    |  60   |输入                            |
    |  61   |输出                            |
    |  62   |创建自动分帐目                       |
    |  63   |激活                            |
    |  64   |生成                            |
    |  65   |重新组织                          |
    |  66   |刷新                            |
    |  67   |翻译                            |
    |  68   |模块                            |
    |  69   |放弃                            |
    |  70   |管理员                           |
    |  71   |分析                            |
    |  72   |计划                            |
    |  73   |Execute Digital Signature     |
    |  74   |撤回批准                          |
    |  75   |移去                            |
    |  76   |输入                            |
    |  77   |预输入                           |
    |  78   |分配                            |
    |  79   |Assign Role to Composite Role |
    |  80   |Print                         |
    |  81   |调度                            |
    |  82   |补充                            |
    |  83   |对方确认                          |
    |  84   |结算                            |
    |  85   |转换                            |
    |  86   |Rebook                        |
    |  87   |返回                            |
    |  88   |完成                            |
    |  89   |Subscribe                     |
    |  90   |复制                            |
    |  91   |重新激活                          |
    |  92   |Create from Template          |
    |  93   |计算                            |
    |  94   |Override                      |
    |  95   |解锁                            |
    |  96   |Reject                        |
    |  97   |设置                            |
    |  98   |下达标记                          |
    |  99   |生成发票清单                        |
    |  A1   |Accrue                        |
    |  A2   |工资                            |
    |  A3   |修改状态                          |
    |  A4   |重新提交                          |
    |  A5   |显示报表                          |
    |  A6   |用筛选器读取                        |
    |  A7   |用筛选器写入                        |
    |  A8   |处理大量数据                        |
    |  A9   |发送                            |
    |  AA   |Print Again                   |
    |  AB   |结算                            |
    |  B1   |显示许可值                         |
    |  B2   |技术性完成                         |
    |  B3   |导出                            |
    |  B8   |再次执行                          |
    |  B9   |Post Parked Document          |
    |  BD   |维护对象在非属主系统                    |
    |  BE   |IMG 项目                        |
    |  C1   |支付卡维护                         |
    |  C2   |支付卡显示                         |
    |  C3   |手工权限维护                        |
    |  C4   |Develope Payment Card         |
    |  C5   |Reopen                        |
    |  C8   |确认更改                          |
    |  D1   |复制                            |
    |  DL   |下载                            |
    |  DP   |删除计划                          |
    |  E0   |保存摘录                          |
    |  E6   |删除自有摘录                        |
    |  E7   |删除文本摘录                        |
    |  EP   |Prioritise extract            |
    |  FP   |修改客户自动选项                      |
    |  G1   |Maintain Budget               |
    |  G2   |Billing                       |
    |  G3   |Maintain Overhead Costs       |
    |  G4   |Maintain Reevaluation         |
    |  G5   |Park                          |
    |  G6   |Transfer Budget               |
    |  G7   |Reverse                       |
    |  GL   |一般总览                          |
    |  H1   |Deactivate                    |
    |  H2   |Activate Logging              |
    |  H3   |Deactivate Logging            |
    |  KA   |激活布告                          |
    |  KI   |Knock In                      |
    |  KO   |Knock Out                     |
    |  KS   |冲销布告                          |
    |  KU   |Give notice                   |
    |  L0   |All functions                 |
    |  L1   |函数范围级 1                       |
    |  L2   |函数范围级 2                       |
    |  LM   |Change LDAP Mapping           |
    |  LS   |Change LDAP Sync. Switch      |
    |  MA   |Deactivate mod.assistant      |
    |  P0   |Accept CCMS CSM data          |
    |  P1   |Edit CCMS CSM data            |
    |  P2   |Maintain CCMS CSM methods     |
    |  P3   |Register CCMS CSM remote systm|
    |  PA   |Open period                   |
    |  PB   |Close period                  |
    |  PC   |Open Consolid. Grp Processing |
    |  PD   |Close Consolid. Unit Processng|
    |  PP   |Set as productive             |
    |  PU   |Publish                       |
    |  RS   |Send to New Recipient         |
    |  S1   |编辑模板                          |
    |  S2   |Edit specification            |
    |  SO   |Edit in Sourcing              |
    |  SZ   |Assign Switch Framework Switch|
    |  U2   |比较业务量                         |
    |  U3   |更改业务量比较                       |
    |  U4   |添加业务量数据                       |
    |  UL   |上载                            |
    |  V1   |Create version                |
    |  V2   |Change Version                |
    |  V3   |Display Version               |
    |  V4   |Delete Version                |
    |  V5   |Transport Version             |
    |  V6   |Delete Version Header         |
    |  VE   |Create an Enhancement ID      |
    |  VF   |Expired                       |
    ----------------------------------------

    sy-subrc 一些重要返回值如下:
      0:  用户权限检查通过.
      4:  用户权限不足.
      8:  参数的数量不正确.
      12:  权限对象不存在. 

    参考链接:https://www.cnblogs.com/mingdashu/p/authority-check.html

  • 相关阅读:
    Blank page instead of the SharePoint Central Administration site
    BizTalk 2010 BAM Configure
    Use ODBA with Visio 2007
    Handling SOAP Exceptions in BizTalk Orchestrations
    BizTalk与WebMethods之间的EDI交换
    Append messages in BizTalk
    FTP protocol commands
    Using Dynamic Maps in BizTalk(From CodeProject)
    Synchronous To Asynchronous Flows Without An Orchestration的简单实现
    WSE3 and "Action for ultimate recipient is required but not present in the message."
  • 原文地址:https://www.cnblogs.com/zs-chenkang/p/14029233.html
Copyright © 2020-2023  润新知