Thursday, January 1, 2009

Generate a Passwoard for Report

*&---------------------------------------------------------------------*
*& Report ZGENERATEPASSWORD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZGENERATEPASSWORD.
* Data declaration
DATA : w_password TYPE char10, " Generated Password is stored here
w_pass_chars(80). " We provide the characters we desire
" in the password
CONCATENATE
'ABCDEFGHJKLMNPQRSTUVWXYZ'
'abcdefghijklmnopqrstuvwxyz'
'123456789@$%&/\()=+-#~ []{}'
INTO w_pass_chars.
* Function module which generates the password
CALL FUNCTION 'RSEC_GENERATE_PASSWORD'
EXPORTING
alphabet = w_pass_chars
alphabet_length = 0
force_init = ' '
output_length = 10
downwards_compatible = ' '
IMPORTING
output = w_password
EXCEPTIONS
some_error = 1.IF sy-subrc NE 0.
* Trigger some message, as required.
ENDIF.WRITE:/ 'The generated password is: ', w_password.

No comments:

Post a Comment