05-01-2009 5:52 PM
Hello Experts,
I have written a report to change the user password in all the sytem. We are on CUA. We have three sytem R/3, BW and SRM. When i am using transaction SU01 to change the password of user in all the system,it works fine with all three system. Password gets changed in all three system ( SAP standard functionality )
The same code which is written inside SU01 to reset password, i have copied to my Z report. This report is written inside R/3 system. I have used following function module . Password is getting changed only in R/3 system but not in satellite system i.e BW and SRM.
Help to resolve this problem.
CALL FUNCTION 'SUSR_USER_SURFACE_PASSWORD'
EXPORTING
user_name = gv_uid
IMPORTING
password = gv_password
okcode = gv_ok_code
delete_password = gv_pswdel.
IF gv_ok_code = 'SAVE'.
CALL FUNCTION 'SUSR_ZBV_CHECK_IF_ACTIVE'
EXCEPTIONS
active = 1
not_active = 2
invalid_model = 3
OTHERS = 4.
IF sy-subrc = 1.
CALL FUNCTION 'SUSR_USER_BUFFERS_FILL'
EXPORTING
fill_all = 'X'
user_name = gv_uid
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'SUSR_USER_PASSWORD_PUT'
EXPORTING
user_name = gv_uid
password = gv_password
delete_password = gv_pswdel
EXCEPTIONS
user_name_not_exist = 1
password_not_allowed = 2
OTHERS = 3.
IF sy-subrc = 0.
CALL FUNCTION 'SUSR_USER_BUFFERS_TO_DB'
EXPORTING
message_out = 'X'
distribution = ' '
EXCEPTIONS
no_logondata_for_new_user = 1
no_init_password = 2
db_insert_usr02_failed = 3
db_update_usr02_failed = 4
db_insert_usr01_failed = 5
db_update_usr01_failed = 6
db_insert_usr05_failed = 7
db_update_usr05_failed = 8
db_insert_usr21_failed = 9
db_update_usr21_failed = 10
internal_error = 11
OTHERS = 12.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
commit work.
endif.
Regards,
SVS
05-01-2009 8:44 PM
Why don't you just use SU01?
Anyway, functionally the user management transactions have corresponding BAPI's (business application program interfaces) which allow you to do the same from your own application coding, without creating inconsistencies or experiencing different (unreleased) behaviour.
Take a look in transaction BAPI at the Change method => function module BAPI_USER_CHANGE.
Just call that...
Cheers,
Julius
05-01-2009 8:44 PM
Why don't you just use SU01?
Anyway, functionally the user management transactions have corresponding BAPI's (business application program interfaces) which allow you to do the same from your own application coding, without creating inconsistencies or experiencing different (unreleased) behaviour.
Take a look in transaction BAPI at the Change method => function module BAPI_USER_CHANGE.
Just call that...
Cheers,
Julius
05-02-2009 3:56 PM
>
> The same code which is written inside SU01 to reset password, i have copied to my Z report.
>
Hi SVS,
maybe you did not try to reset the PW in SU01 for an existing user until now.....
SU01 does the same, what you found in your report. If the user exists already, the password is only reset for the cua central system itself. To reset the password for child systems, you have to use the reset function on the entry screen of SU01.
Nevertheless, the suggestion of Julius is the easiest / best way to get that fuunctionality.
b.rgds
Bernhard
05-08-2009 2:57 PM
Hello Julius and Bernhard,
Thanks for reply. Password reset can be done through SU01, but once you give authorization of SU01 to any user then that user is in position to change the password of any user in the system. We wants to restrict it at user group level which i don't think possible through SU01. This is the reason we are going for Z report for password change.
Regards,
SVS
05-08-2009 3:08 PM
> Password reset can be done through SU01, but once you give authorization of SU01 to any user then that user is in position to change the password of any user in the system. We wants to restrict it at user group level which i don't think possible through SU01.
This is only partially true and only if you do not assign users to user groups. You can do this in SU01.
> This is the reason we are going for Z report for password change.
I don't see why you need a Z-report for that.
Cheers,
Julius