ABAP 获取登陆者的IP地址和主机名

DATA:   opcode_usr_attr(1) TYPE x VALUE 5,
       terminal          TYPE usr41-terminal.

* 获取终端名  OPCODE 码在 TSKHINCL 252行
CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_usr_attr
          ID'TERMINAL' FIELD terminal.
WRITE:/ 'Terminal:', terminal.

"获取登陆IP地址
DATA:ip TYPE string.
CALL METHOD cl_gui_frontend_services=>get_ip_address
  RECEIVING
    ip_address         = ip
       .

WRITE:/ 'IP :',ip.

你可能感兴趣的:(程序人生,ABAPer)