Showing posts with label Function module to generate Password. Show all posts
Showing posts with label Function module to generate Password. Show all posts

Function module to generate password

You should use the addition LOWER CASE to take care of the Lower Case characters. Please see the code given below.

REPORT ZEX_PASSWORD .

Parameter: p_char(100) LOWER CASE.

Data: d_password(8),
d_len type i.


d_len = STRLEN( p_char ).

CALL FUNCTION 'RSEC_GENERATE_PASSWORD'
EXPORTING
ALPHABET = p_char
ALPHABET_LENGTH = d_len
FORCE_INIT = ' '
OUTPUT_LENGTH = 8
IMPORTING
OUTPUT = d_password
EXCEPTIONS
SOME_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.