sap 登陆时候与用户IP地址绑定登陆

登陆时候与用户IP地址绑定登陆
首先在系统里建立R/3用户和IP地址的对应的关系表USERLOGON,包括信息(R/3用户名/IP地址),然
后通过批导入的方式将对应关系数据导入系统表里.
其次在R/3用户登陆增强(SUSR0001)写代码验证用户登陆时候的R/3用户名和IP地址在系统对应关
系表里是否有,通过则允许登陆,未通过则不允许登陆.
增强代码如下:
           CALL FUNCTION 'TH_USER_INFO'
             IMPORTING HOSTADDR = HOSTADR   "like UINFO-HOSTADR (hex)
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.
_selectCOUNT(*) INTO XH_countFROM USERLOGON WHERE BNAME = SY-UNAME
AND IP = IPTXT.
IF XH_count< 0.
 MESSAGE I003(ZTXBHB).
 CALL 'SYST_LOGOFF'."退出SAP系统
ELSE.
 MESSAGE I002(ZTXBHB).”登陆
ENDIF.

你可能感兴趣的:(SAP)