之前有朋友做过RFC登录验证,后来群里又有很多人问SAP的登录验证函数。
后来自己找找了,看看了,然后改写了一个LOGON DATA CHECK。。。
FUNCTION ZUSER_CHECK_LOGON_DATA. *"---------------------------------------------------------------------- *"*"本地接口: *" IMPORTING *" VALUE(BNAME) LIKE RSYST-BNAME DEFAULT SY-UNAME *" VALUE(PASSWORD) LIKE RSYST-BCODE OPTIONAL *" EXPORTING *" VALUE(MESSAGE) TYPE STRING *"---------------------------------------------------------------------- DATA: PWDSTATE TYPE XUPWDSTATE. CALL 'INTERNET_USER_LOGON' ID 'AUTHTYPE' FIELD 'P' "password ID 'TESTMODE' FIELD SPACE ID 'UNAME' FIELD BNAME ID 'PASSW' FIELD PASSWORD ID 'PASSFLAG' FIELD PWDSTATE. CASE SY-SUBRC. WHEN 0 OR 4. MESSAGE = 'Correct!'. WHEN 1. MESSAGE = 'user / password incorrect!'. WHEN 2. MESSAGE = 'user locked!'. WHEN 3. MESSAGE = 'STOP_SESSION!'. WHEN 6. MESSAGE = 'CUA master record!'. WHEN 7. MESSAGE = 'bad_user_type (not DIALOG type)!'. WHEN 8. MESSAGE = 'outside validity!'. WHEN 10. MESSAGE = 'SNC required!'. WHEN 50. MESSAGE = 'password disabled'. WHEN 51. MESSAGE = 'initial pwd expired'. WHEN 52. MESSAGE = 'user has no password!'. WHEN 52. MESSAGE = 'password will not be evaluated since there have been too many failed password logon attempts!'. WHEN OTHERS. ENDCASE. ENDFUNCTION.