代码语言:javascript复制
FUNCTION ZIEB_RFC_CHECK04.
*"----------------------------------------------------------------------
*"*"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.