zoukankan      html  css  js  c++  java
  • SAP根据用户名查找使用的TCODE

    由于某些部门的权限变动频繁,设置也比较复杂,现做一个查找TCODE事务代码的程序方便业务部门管理。

    *&---------------------------------------------------------------------*
    *& Report ZMMRP087A
    *&---------------------------------------------------------------------*
    *&
    *&---------------------------------------------------------------------*
    REPORT ZMMRP087A.
    TABLES:USR02.
    TYPES:BEGIN OF TY_DATA,
            BNAME TYPE USR02-BNAME,
            TCODE TYPE AGR_TCODES-TCODE,
            TTEXT TYPE TSTCT-TTEXT,"事务代码描述文本
          END OF TY_DATA.
    DATA:LT_TAB TYPE STANDARD TABLE OF TY_DATA.
    
    SELECT-OPTIONS:
    S_USER FOR USR02-BNAME.
    "查找母角色的TCODE
    SELECT USR02~BNAME,
    *AGR_USERS~AGR_NAME,
    AGR_TCODES~TCODE,
    TSTCT~TTEXT
    FROM USR02
    LEFT JOIN AGR_USERS ON AGR_USERS~UNAME = USR02~BNAME
    LEFT JOIN AGR_TCODES ON AGR_USERS~AGR_NAME = AGR_TCODES~AGR_NAME
    LEFT JOIN TSTCT ON TSTCT~TCODE = AGR_TCODES~TCODE
    INTO CORRESPONDING FIELDS OF TABLE @LT_TAB
          WHERE USR02~BNAME IN @S_USER
      AND TSTCT~SPRSL = 1.
    "查找继承角色的TCODE
    SELECT USR02~BNAME,
    *AGR_USERS~AGR_NAME,
    AGR_TCODES~TCODE,
    TSTCT~TTEXT
    FROM USR02
    LEFT JOIN AGR_USERS ON AGR_USERS~UNAME = USR02~BNAME
    LEFT JOIN AGR_DEFINE ON AGR_USERS~AGR_NAME = AGR_DEFINE~AGR_NAME
    LEFT JOIN AGR_TCODES ON AGR_DEFINE~PARENT_AGR = AGR_TCODES~AGR_NAME
      LEFT JOIN TSTCT ON TSTCT~TCODE = AGR_TCODES~TCODE
    APPENDING CORRESPONDING FIELDS OF TABLE @LT_TAB
          WHERE USR02~BNAME IN @S_USER
        AND TSTCT~SPRSL = 1.
    
    SORT LT_TAB BY BNAME TCODE.
    DELETE ADJACENT DUPLICATES FROM LT_TAB.

  • 相关阅读:
    python运行出现TypeError: super() takes at least 1 argument (0 given)错误
    史上最全Python数据分析学习路径图
    Windows平台Python编程必会模块之pywin32
    PyMySQL的基本使用
    python:让源码更安全之将py编译成so
    最高分是多少
    哪些技术可以用在WEB开发中实现会话跟踪
    自定义输入模板
    JAVA中HashMap和Hashtable区别
    Java中ArrayList与LinkedList的区别
  • 原文地址:https://www.cnblogs.com/BruceKing/p/15272973.html
Copyright © 2011-2022 走看看