获取用户信息 ZJPMF_USER_GET
FUNCTION ZJPMF_USER_GET.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(JU_USER_CODE) TYPE CH32
*" EXPORTING
*" VALUE(JU_USER_NAME) TYPE CH32
*" VALUE(JU_PASSWORD) TYPE XUNCODE
*" VALUE(JU_USER_DEPT) TYPE CHARSPEC
*" VALUE(JU_ACTIVE_FLAG) TYPE CHANGE_DOCUMENT
*" VALUE(JU_FLASH_PSW) TYPE CHANGE_DOCUMENT
*" VALUE(JU_SAP_ID) TYPE XUBNAME
*" VALUE(JU_SAP_PSW) TYPE XUNCODE
*" VALUE(JU_EXT_CONN) TYPE CHANGE_DOCUMENT
*" VALUE(JU_NAME_LAST) TYPE AD_NAMELAS
*" VALUE(JU_USER_NAME2) TYPE CH32
*" VALUE(JU_PASSWORD2) TYPE XUNCODE
*" VALUE(JU_USER_DEPT2) TYPE CHARSPEC
*" VALUE(JU_ACTIVE_FLAG2) TYPE CHANGE_DOCUMENT
*" VALUE(JU_FLASH_PSW2) TYPE CHANGE_DOCUMENT
*" VALUE(JU_SAP_ID2) TYPE XUBNAME
*" VALUE(JU_SAP_PSW2) TYPE XUNCODE
*" VALUE(JU_EXT_CONN2) TYPE CHANGE_DOCUMENT
*" VALUE(JU_NAME_LAST2) TYPE AD_NAMELAS
*" VALUE(JU_USER_NAME3) TYPE CH32
*" VALUE(JU_PASSWORD3) TYPE XUNCODE
*" VALUE(JU_USER_DEPT3) TYPE CHARSPEC
*" VALUE(JU_ACTIVE_FLAG3) TYPE CHANGE_DOCUMENT
*" VALUE(JU_FLASH_PSW3) TYPE CHANGE_DOCUMENT
*" VALUE(JU_SAP_ID3) TYPE XUBNAME
*" VALUE(JU_SAP_PSW3) TYPE XUNCODE
*" VALUE(JU_EXT_CONN3) TYPE CHANGE_DOCUMENT
*" VALUE(JU_NAME_LAST3) TYPE AD_NAMELAS
*"----------------------------------------------------------------------
* TABLES:ZJPMF_USER.
DATA: BEGIN OF WA_USER,
USER_NAME TYPE ZJPMF_USER-USER_NAME,
PASSWORD TYPE ZJPMF_USER-PASSWORD,
USER_DEPT TYPE ZJPMF_USER-USER_DEPT,
ACTIVE_FLAG TYPE ZJPMF_USER-ACTIVE_FLAG,
FLASH_PSW TYPE ZJPMF_USER-FLASH_PSW,
SAP_ID TYPE ZJPMF_USER-SAP_ID,
SAP_PSW TYPE ZJPMF_USER-SAP_PSW,
EXT_CONN TYPE ZJPMF_USER-EXT_CONN,
END OF WA_USER.
DATA: IT_USER LIKE STANDARD TABLE OF WA_USER WITH HEADER LINE.
DATA II type I VALUE 0.
DATA:WA_NAME_FIRST TYPE ADRP-NAME_FIRST.
TRANSLATE JU_USER_CODE TO UPPER CASE .
SELECT USER_NAME PASSWORD USER_DEPT ACTIVE_FLAG FLASH_PSW SAP_ID SAP_PSW EXT_CONN UP TO 3 ROWS INTO CORRESPONDING FIELDS OF TABLE IT_USER
FROM ZJPMF_USER
WHERE USER_CODE = JU_USER_CODE AND ACTIVE_FLAG EQ 'X'
ORDER BY SAP_ID.
IF SY-SUBRC = 0 and IT_USER[] is NOT INITIAL .
LOOP AT IT_USER .
II = II + 1.
IF II = 1 .
JU_USER_NAME = IT_USER-USER_NAME.
JU_PASSWORD = IT_USER-PASSWORD.
JU_USER_DEPT = IT_USER-USER_DEPT.
JU_ACTIVE_FLAG = IT_USER-ACTIVE_FLAG.
JU_FLASH_PSW = IT_USER-FLASH_PSW.
JU_SAP_ID = IT_USER-SAP_ID.
JU_SAP_PSW = IT_USER-SAP_PSW.
JU_EXT_CONN = IT_USER-EXT_CONN.
SELECT SINGLE NAME_LAST NAME_FIRST INTO (JU_NAME_LAST,WA_NAME_FIRST)
FROM ADRP INNER JOIN USR21 ON ADRP~PERSNUMBER = USR21~PERSNUMBER
WHERE USR21~BNAME = IT_USER-SAP_ID.
CONCATENATE JU_NAME_LAST WA_NAME_FIRST INTO JU_NAME_LAST.
ELSEIF II = 2.
JU_USER_NAME2 = IT_USER-USER_NAME.
JU_PASSWORD2 = IT_USER-PASSWORD.
JU_USER_DEPT2 = IT_USER-USER_DEPT.
JU_ACTIVE_FLAG2 = IT_USER-ACTIVE_FLAG.
JU_FLASH_PSW2 = IT_USER-FLASH_PSW.
JU_SAP_ID2 = IT_USER-SAP_ID.
JU_SAP_PSW2 = IT_USER-SAP_PSW.
JU_EXT_CONN2 = IT_USER-EXT_CONN.
SELECT SINGLE NAME_LAST NAME_FIRST INTO (JU_NAME_LAST2,WA_NAME_FIRST)
FROM ADRP INNER JOIN USR21 ON ADRP~PERSNUMBER = USR21~PERSNUMBER
WHERE USR21~BNAME = IT_USER-SAP_ID.
CONCATENATE JU_NAME_LAST2 WA_NAME_FIRST INTO JU_NAME_LAST2.
ELSE.
JU_USER_NAME3 = IT_USER-USER_NAME.
JU_PASSWORD3 = IT_USER-PASSWORD.
JU_USER_DEPT3 = IT_USER-USER_DEPT.
JU_ACTIVE_FLAG3 = IT_USER-ACTIVE_FLAG.
JU_FLASH_PSW3 = IT_USER-FLASH_PSW.
JU_SAP_ID3 = IT_USER-SAP_ID.
JU_SAP_PSW3 = IT_USER-SAP_PSW.
JU_EXT_CONN3 = IT_USER-EXT_CONN.
SELECT SINGLE NAME_LAST NAME_FIRST INTO (JU_NAME_LAST3,WA_NAME_FIRST)
FROM ADRP INNER JOIN USR21 ON ADRP~PERSNUMBER = USR21~PERSNUMBER
WHERE USR21~BNAME = IT_USER-SAP_ID.
CONCATENATE JU_NAME_LAST3 WA_NAME_FIRST INTO JU_NAME_LAST3.
ENDIF.
CLEAR WA_NAME_FIRST.
CLEAR IT_USER.
ENDLOOP.
ENDIF.
ENDFUNCTION.
更改密码
FUNCTION ZJPMF_USER_SET.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(JU_USER_CODE) TYPE CH32
*" VALUE(JU_PASSWORD) TYPE XUNCODE
*" EXPORTING
*" VALUE(RTN_MESSAGE) TYPE CH32
*"----------------------------------------------------------------------
TRANSLATE JU_USER_CODE TO UPPER CASE .
UPDATE ZJPMF_USER
SET PASSWORD = JU_PASSWORD FLASH_PSW = ' ' CHANGE_DATE = SY-DATUM
WHERE USER_CODE = JU_USER_CODE.
IF SY-SUBRC = 0 .
RTN_MESSAGE = 'YES'.
ELSE.
RTN_MESSAGE = 'NO'.
ENDIF.
ENDFUNCTION.