Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

passwork generation

Former Member
0 Likes
716

hi experts

i want to generate password based on date and time.

for every date and time i enter password has to be generated randomly encrypting date and time.

4 REPLIES 4
Read only

Former Member
0 Likes
654

Hi sai,

use the FM RSEC_GENERATE_PASSWORD

For generating the password the following parameters need to be passed to the Function Module.

ALPHABET TYPE C With the help of these letters the password is generated.

ALPHABET_LENGTH TYPE I The total length of the above mentioned field. This can be calculated with the

help of STRLEN or can be hard coded.

FORCE_INIT TYPE C CAN be left blank

OUTPUT_LENGTH TYPE I SAP password are usually 8 characters in lenght. So this can be defaulted to 8.

If you are using PARAMETER for inputting the 'ALPHABET' then 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.

Write:/ d_password.

Reward if useful.

Regards

Divya

Read only

Former Member
0 Likes
654
Read only

Former Member
0 Likes
654

Hi Sai.

I would like to suggest a reference, it is quite similar to your issue,

[SDN - Standard Reference - PDF - Random Password Generator|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b824c11b-0701-0010-738f-e76dc3d29925]

Hope that's usefull.

Good Luck & Regards.

Harsh Dave