*&---------------------------------------------------------------------* *& Report ZJERRY_SET_PRODUCTIVE_PW *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZAPRMDA_SET_PRODUCTIVE_PW. DATA: BNAME LIKE USR02-BNAME. SELECT-OPTIONS: S_USER FOR BNAME. PARAMETERS: passwd LIKE xu400-newcode. AUTHORITY-CHECK OBJECT 'S_USER_GRP' ID 'CLASS' FIELD '*' ID 'ACTVT' FIELD '02'. IF SY-SUBRC <> 0. MESSAGE E150(00) WITH ''. * Sie haben keine Berechtigung f��r die Funktion & RETURN. ENDIF. DATA: L_USR LIKE USR02-BNAME OCCURS 0, WA_USR LIKE LINE OF L_USR, return LIKE bapiret2 OCCURS 0, l_return LIKE LINE OF RETURN, L TYPE I. IF S_USER IS INITIAL. LEAVE PROGRAM. ENDIF. SELECT BNAME FROM USR02 INTO TABLE L_USR WHERE BNAME IN S_USER. LOOP AT L_USR INTO WA_USR. REFRESH RETURN. * User entsperren (durch Falschanmeldungen wahrscheinlich gesperrt) CALL FUNCTION 'BAPI_USER_UNLOCK' EXPORTING username = WA_USR TABLES return = return. DESCRIBE TABLE RETURN LINES L. IF L > 0. READ TABLE RETURN INTO L_RETURN INDEX 1. IF L_RETURN-TYPE <> 'S'. FORMAT COLOR COL_NEGATIVE. WRITE: / WA_USR , L_RETURN-TYPE, L_RETURN-MESSAGE. FORMAT COLOR COL_NORMAL. CONTINUE. ELSE. WRITE: / WA_USR,'unlocked.'. ENDIF. ENDIF. * Password ?ndern REFRESH RETURN. CALL FUNCTION 'BAPI_USER_CHANGE' EXPORTING username = WA_USR password = passwd passwordx = 'X' TABLES return = return. DESCRIBE TABLE RETURN LINES L. IF L > 0. READ TABLE RETURN INTO L_RETURN INDEX 1. IF L_RETURN-TYPE <> 'S'. FORMAT COLOR COL_NEGATIVE. WRITE: / WA_USR , L_RETURN-TYPE, L_RETURN-MESSAGE. FORMAT COLOR COL_NORMAL. CONTINUE. ELSE. WRITE: / WA_USR,'PW set.'. ENDIF. ENDIF. UPDATE USR02 SET LTIME = '010000' PWDINITIAL = '2' WHERE BNAME = WA_USR. COMMIT WORK. ENDLOOP. WRITE: / 'Program terminated succesfully.'.