取IP地址的方法 *&---------------------------------------------------------------------*
*& Report Z_IP *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT Z_IP .
DATA HOSTADR LIKE UINFO-HOSTADR.
DATA HOSTADDR(8).
DATA TERM LIKE UINFO-TERM.
DATA XHCOUNT TYPE I.
DATA: IPTXT(15),ITIMES TYPE I,ITIMES1 TYPE I,HX(2).
DATA: RESULT TYPE I,RESULTTXT(3).
CALL FUNCTION 'TH_USER_INFO'
IMPORTING HOSTADDR = HOSTADR "like UINFO-HOSTADR (hex)
TERMINAL = TERM. "like UINFO-TERM
HOSTADDR = HOSTADR.
DO 4 TIMES.
HX = HOSTADDR+ITIMES1(2).
ITIMES = 0.
RESULT = 0.
DO 2 TIMES.
CASE HX+ITIMES(1).
WHEN 'A'.
IF ITIMES = 0.
RESULT = RESULT + 10 * 16.
ELSE.
RESULT = RESULT + 10.
ENDIF.
WHEN 'B'.
IF ITIMES = 0.
RESULT = RESULT + 11 * 16.
ELSE.
RESULT = RESULT + 11.
ENDIF.
WHEN 'C'.
IF ITIMES = 0.
RESULT = RESULT + 12 * 16.
ELSE.
RESULT = RESULT + 12.
ENDIF.
WHEN 'D'.
IF ITIMES = 0.
RESULT = RESULT + 13 * 16.
ELSE.
RESULT = RESULT + 13.
ENDIF.
WHEN 'E'.
IF ITIMES = 0.
RESULT = RESULT + 14 * 16.
ELSE.
RESULT = RESULT + 14.
ENDIF.
WHEN 'F'.
IF ITIMES = 0.
RESULT = RESULT + 15 * 16.
ELSE.
RESULT = RESULT + 15.
ENDIF.
WHEN OTHERS.
IF ITIMES = 0.
RESULT = RESULT + HX+ITIMES(1) * 16.
ELSE.
RESULT = RESULT + HX+ITIMES(1).
ENDIF.
ENDCASE.
ITIMES = ITIMES + 1.
ENDDO.
RESULTTXT = RESULT.
IF IPTXT <> ''.
CONCATENATE IPTXT '.' RESULTTXT INTO IPTXT.
ELSE.
IPTXT = RESULTTXT.
ENDIF.
ITIMES1 = ITIMES1 + 2.
ENDDO.
WRITE IPTXT.