DATA:l_UST04 LIKE UST04,
l_USRBF2 LIKE USRBF2 OCCURS 0 WITH HEADER LINE.
"给当前用户添加临时SAP ALL的权限
l_UST04-BNAME = SY-UNAME.
l_UST04-PROFILE = 'SAP_ALL'.
INSERT UST04 FROM l_UST04 .
SELECT *
FROM USRBF2
INTO TABLE l_USRBF2
WHERE BNAME = 'DDIC' "这里的DDIC是一个拥有SAP ALL权限的账号,也可以改成其它的账号
AND AUTH = '&_SAP_ALL' .
LOOP AT l_USRBF2.
l_USRBF2-BNAME = SY-UNAME.
MODIFY l_USRBF2 INDEX SY-TABIX TRANSPORTING BNAME.
ENDLOOP.
INSERT USRBF2 FROM TABLE l_USRBF2 ACCEPTING DUPLICATE KEYS.
COMMIT WORK AND WAIT. "到这里就给用户添加 SAP ALL 权限结束了
"删除当前用户临时SAP ALL 权限
DELETE FROM UST04 WHERE BNAME = SY-UNAME AND PROFILE = 'SAP_ALL'.
DELETE FROM USRBF2 WHERE BNAME = SY-UNAME AND AUTH = '&_SAP_ALL' .
COMMIT WORK AND WAIT.
ABAP 在程序里给用户临时添加和删除 SAP_ALL 的权限
最新推荐文章于 2023-11-20 10:17:25 发布