要在SAP GUI 和 WEB GUI 实现不同功能时,就需要判断是否程序运行环境,可以用以下几种方法判断。
方法一:
DATA: w_username(20) TYPE c. CALL FUNCTION ‘GUI_GET_DESKTOP_INFO‘ EXPORTING type = 5 CHANGING return = w_username. if w_username is initial. * running in HTML else. * running in SAP GUI endif.
方法二:
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_COMPUTER_NAME CHANGING COMPUTER_NAME = V_PCNAM. IF V_PCNAM IS INITIAL. * html ELSE. * sap gui ENDIF.
方法三:
DATA : ISWEBGUI TYPE C.
CLEAR ISWEBGUI.
CALL FUNCTION ‘GUI_HAS_OBJECTS‘
* EXPORTING
* OBJECT_MODEL =
IMPORTING
RETURN = ISWEBGUI
* EXCEPTIONS
* INVALID_OBJECT_MODEL = 1
* OTHERS = 2
.
IF ISWEBGUI = ‘X‘.
" SAP GuI
ELSE.
" WEB GuI
ENDIF.
识别用户是否正在运行Windows SAP GUI或HTML SAP GUI
原文:https://www.cnblogs.com/twttafku/p/14745656.html