首页 > 代码库 > 获取当前登录用户的IP地址代码

获取当前登录用户的IP地址代码

 1 *&---------------------------------------------------------------------* 2 *& Report  YDEMO_RICK 3 *& 4 *&---------------------------------------------------------------------* 5 *& 6 *& 7 *&---------------------------------------------------------------------* 8 REPORT  ydemo_rick. 9 10 DATA hostadr LIKE uinfo-hostadr.11 DATA hostaddr(8).12 DATA term LIKE uinfo-term.13 DATA xhcount TYPE i.14 DATA: iptxt(15),itimes TYPE i,itimes1 TYPE i,hx(2).15 DATA: result TYPE i,resulttxt(3).16 17 CALL FUNCTION TH_USER_INFO18   IMPORTING19     hostaddr = hostadr "like UINFO-HOSTADR (hex)20     terminal = term. "like UINFO-TERM21 hostaddr = hostadr.22 DO 4 TIMES.23   hx = hostaddr+itimes1(2).24   itimes = 0.25   result = 0.26   DO 2 TIMES.27     CASE hx+itimes(1).28       WHEN A.29         IF itimes = 0.30           result = result + 10 * 16.31         ELSE.32           result = result + 10.33         ENDIF.34       WHEN B.35         IF itimes = 0.36           result = result + 11 * 16.37         ELSE.38           result = result + 11.39         ENDIF.40       WHEN C.41         IF itimes = 0.42           result = result + 12 * 16.43         ELSE.44           result = result + 12.45         ENDIF.46       WHEN D.47         IF itimes = 0.48           result = result + 13 * 16.49         ELSE.50           result = result + 13.51         ENDIF.52       WHEN E.53         IF itimes = 0.54           result = result + 14 * 16.55         ELSE.56           result = result + 14.57         ENDIF.58       WHEN F.59         IF itimes = 0.60           result = result + 15 * 16.61         ELSE.62           result = result + 15.63         ENDIF.64       WHEN OTHERS.65         IF itimes = 0.66           result = result + hx+itimes(1) * 16.67         ELSE.68           result = result + hx+itimes(1).69         ENDIF.70     ENDCASE.71     itimes = itimes + 1.72   ENDDO.73   resulttxt = result.74   IF iptxt <> ‘‘.75     CONCATENATE iptxt . resulttxt INTO iptxt.76   ELSE.77     iptxt = resulttxt.78   ENDIF.79   itimes1 = itimes1 + 2.80 ENDDO.81 WRITE iptxt.