‎2008 Jul 18 6:30 AM
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.
‎2008 Jul 18 6:33 AM
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
‎2008 Jul 18 6:37 AM
Hi
Hope this link will help you
http://abaplovers.blogspot.com/2008/06/sap-abap-generate-password-function.html
Regards,
Sravanthi
‎2008 Jul 18 6:40 AM
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
‎2008 Jul 18 6:40 AM