剛發現一段ABAP程式可以直接抓到用戶端的USER登入的目前帳號比方網域帳號

做個記錄

======================

 

DATA: OS_USER TYPE STRING .

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_USER_NAME
CHANGING
USER_NAME = OS_USER
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL METHOD CL_GUI_CFW=>FLUSH
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

WRITE OS_USER.

=====================

ROACH 發表在 痞客邦 PIXNET 留言(0) 人氣()