剛剛看到的
http://www.itpub.net/thread-1142547-1-4.html
FUNCTION Z_RETURN_USERNAME.
*"----------------------------------------------------------------------
*"*"Local interface:
*" EXPORTING
*" VALUE(USERNAME) TYPE STRING
*" VALUE(DOMAINNAME) TYPE STRING
*"----------------------------------------------------------------------
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_USER_NAME
CHANGING
USER_NAME = USERNAME
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_FRONTEND_SERVICES=>ENVIRONMENT_GET_VARIABLE
EXPORTING
VARIABLE = 'USERDOMAIN'
CHANGING
VALUE = DOMAINNAME
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.
ENDFUNCTION.
- Mar 24 Tue 2009 22:23
ABAP得到當前登入網域帳號的方法
全站熱搜
留言列表
發表留言