ABAP常用小技巧-知识点积累
7.20 | 根据字母列表生成随机密码 |
REPORT z_barry_generate_password. | |
DATA : pass(10) type c. | |
DATA: albet(80). | |
CONCATENATE ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ | |
‘abcdefghijklmnopqrstuvwxyz’ | |
‘123456789~!#$%^&*()[]/\{}’ | |
INTO albet. | |
CALL FUNCTION ‘RSEC_GENERATE_PASSWORD’ | |
EXPORTING | |
alphabet = albet | |
output_length = 4 | |
IMPORTING | |
output = pass | |
EXCEPTIONS | |
some_error = 1. | |
WRITE:pass. | |
随机生成数字需要调用的函数 | |
data: | |
l_value type int4, | |
l_str type char7. | |
call function ‘QF05_RANDOM_INTEGER’ | |
exporting | |
ran_int_max = 9999999 | |
ran_int_min = 1000000 | |
importing | |
ran_int = l_value. |