语法:
CALL TRANSACTION T-CODE WITH|WITHOUT AUTHORITY-CHECK
USING bdc_tab [OPTIONS FROM opt].
示例:
程序:ZPSR018_A
T-CODE: ZPSR018A
TRY.
CALL TRANSACTION 'ZPSR018A' WITH AUTHORITY-CHECK.
CATCH cx_sy_authorization_error ##NO_HANDLER.
MESSAGE s001(00) WITH '无此事务代码操作权限,请检查' DISPLAY LIKE 'E'.
ENDTRY.
替换成SUBMIT:
事物代码权限对象S_TCODE。
首先检查权限对象S_TCODE,判断是否有程序对应事务码的操作权限,然后SUBMIT程序
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'TCD' FIELD 'ZPSR018A'.
IF sy-subrc <> 0.
MESSAGE s001(00) WITH '无此事务代码操作权限,请检查' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
SUBMIT zpsr018_A WITH s_pspid IN gra_pspid
WITH s_vernr IN gra_vernr.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17901.html