通过函数 TERMINAL_ID_GET能取得计算机名称和IP地址。
例子代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
REPORT ztest_get_ip. DATA:lv_name TYPE char40. DATA:lv_ip TYPE char20. DATA:lv_terminal TYPE xuterminal. CALL FUNCTION 'TERMINAL_ID_GET' EXPORTING username = sy-uname IMPORTING terminal = lv_terminal EXCEPTIONS multiple_terminal_id = 1 no_terminal_found = 2 OTHERS = 3. IF lv_terminal IS NOT INITIAL . SPLIT lv_terminal AT '-' INTO lv_ip lv_name . WRITE:lv_terminal, / lv_name, / lv_ip. ENDIF . |
运行结果:
以上。
发表评论