ABAP get ip address program example

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.

 

你可能感兴趣的:(C++,c,C#,F#)