method USERDETAILSSET_GET_ENTITY.
DATA: is_key_tab TYPE /IWBEP/s_MGW_NAME_VALUE_PAIR.
READ TABLE it_key_tab INTO is_key_tab INDEX 1.
DATA(lv) = is_key_tab-value.
TRANSLATE lv TO UPPER CASE.
SELECT SINGLE Bname
Langu
FROM usr01 INTO CORRESPONDING FIELDS OF ER_ENTITY WHERE Bname = lv."is_key_tab-VALUE.
endmethod.
METHOD userdetailsset_update_entity.
DATA:is_update TYPE zcl_zuser_unlock_mpc=>ts_userdetails.
io_data_provider->read_entry_data( IMPORTING es_data = is_update ).
DATA(lv_user) = is_update-bname.
DATA:logondata TYPE uslogond.
DATA(repid) = sy-repid.
DATA(reptitle) = sy-title.
CALL FUNCTION 'SUSR_USER_LOGONDATA_GET'
EXPORTING
user_name = lv_user
IMPORTING
user_logondata = logondata
EXCEPTIONS
user_name_not_exist = 1
OTHERS = 2.
DATA: lv_password(8),
lv_newpassword TYPE xu400-newcode.
DATA:lc_alphanum TYPE c.
CALL FUNCTION 'RSEC_GENERATE_PASSWORD'
EXPORTING
alphabet = lc_alphanum
output_length = 8
IMPORTING
output = lv_password
EXCEPTIONS
some_error = 1
OTHERS = 2.
IF lv_password IS NOT INITIAL.
** If no number in password, insert a number to meet security policy
IF lv_password NA '123456789'.
lv_password+7(1) = '5'.
ENDIF.
lv_newpassword = lv_password.
CALL FUNCTION 'SUSR_USER_PASSWORD_PUT'
EXPORTING
user_name = lv_user
password = lv_newpassword
EXCEPTIONS
user_name_not_exist = 1
password_not_allowed = 2
OTHERS = 3.
IF sy-subrc = 0.
CALL FUNCTION 'SUSR_USER_BUFFERS_TO_DB'
EXPORTING
message_out = 'X' " note 173081
EXCEPTIONS
no_logondata_for_new_user = 1
no_init_password = 2
db_insert_usr02_failed = 3
db_update_usr02_failed = 4
db_insert_usr01_failed = 5
db_update_usr01_failed = 6
db_insert_usr05_failed = 7
db_update_usr05_failed = 8
db_insert_usr21_failed = 9
db_update_usr21_failed = 10.
IF sy-subrc <> 0.
ENDIF.
MESSAGE 'Generated password has been copied to clipboard!' TYPE 'S'.
COMMIT WORK.
DATA:wa_address TYPE bapiaddr3,
it_returns TYPE bapiret2_t,
it_email TYPE STANDARD TABLE OF bapiadsmtp,
lo_container TYPE REF TO /iwbep/if_message_container.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = lv_user
* CACHE_RESULTS = 'X'
IMPORTING
address = wa_address
TABLES
addsmtp = it_email
return = it_returns.
IF it_email IS NOT INITIAL.
READ TABLE it_email ASSIGNING FIELD-SYMBOL(<fs_email>) INDEX 1.
DATA(v_email) = <fs_email>-e_mail.
ENDIF.
DATA: wa_docdata TYPE sodocchgi1,
wa_objpack TYPE sopcklsti1,
it_objpack TYPE TABLE OF sopcklsti1,
wa_objtxt TYPE solisti1,
it_objtxt TYPE TABLE OF solisti1,
wa_reclist TYPE somlreci1,
it_reclist TYPE TABLE OF somlreci1,
it_lines TYPE TABLE OF tline,
lv_link(35) TYPE c VALUE 'www.thesummitgroup.net',
tab_lines TYPE i,
ls_returns TYPE bapiret2.
DATA: lt_tvarcv_config TYPE TABLE OF tvarvc,
ls_tvarcv_config TYPE tvarvc,
lv_launchpad_url TYPE string,
lv_supinfo_url TYPE string.
CONSTANTS: c_htm TYPE char3 VALUE 'HTM',
c_u TYPE c VALUE 'U',
c_x TYPE c VALUE 'X',
c_space TYPE c VALUE ' ',
c_e TYPE c VALUE 'E',
c_pw TYPE char5 VALUE '{PWD}'.
IF sy-subrc = 0.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'ST'
language = sy-langu
name = 'ZSRM_PWD_UNLOCK'
object = 'TEXT'
TABLES
lines = it_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
LOOP AT it_lines INTO DATA(wa_lines).
APPEND wa_lines-tdline TO it_objtxt.
ENDLOOP.
REPLACE ALL OCCURRENCES OF c_pw IN TABLE
it_objtxt WITH lv_newpassword IN CHARACTER MODE.
DESCRIBE TABLE it_objtxt LINES tab_lines.
READ TABLE it_objtxt INTO wa_objtxt INDEX tab_lines.
wa_docdata-obj_name = text-020. "'TEST_HTML'.
wa_docdata-obj_descr = text-031. "'HISD - Password has been reset and your new password'.
wa_docdata-doc_size = ( tab_lines - 1 ) * 255 + strlen( wa_objtxt ).
CLEAR wa_objpack-transf_bin.
wa_objpack-head_start = 1.
wa_objpack-head_num = 0.
wa_objpack-body_start = 1.
wa_objpack-body_num = tab_lines.
wa_objpack-doc_type = c_htm.
APPEND wa_objpack TO it_objpack.
wa_reclist-receiver = v_email .
wa_reclist-rec_type = c_u.
APPEND wa_reclist TO it_reclist.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_docdata
put_in_outbox = c_space
commit_work = c_x
TABLES
packing_list = it_objpack
contents_txt = it_objtxt
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
id = sy-msgid
number = sy-msgno
textformat = c_htm
message_v1 = sy-msgv1
message_v2 = sy-msgv2
message_v3 = sy-msgv3
message_v4 = sy-msgv4
IMPORTING
message = ls_returns-message.
IF ls_returns-message IS INITIAL.
ls_returns-message = text-022. "'Failed to Send an Email to Supplier'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
lo_container = me->mo_context->get_message_container( ).
CALL METHOD lo_container->add_message_text_only
EXPORTING
iv_msg_type = /iwbep/if_message_container=>gcs_message_type-error
iv_msg_text = 'Order Number not Valid! Do you require pass through codes to get out of line?'
iv_error_category = /iwbep/if_message_container=>gcs_error_category-processing
iv_is_leading_message = abap_true
iv_add_to_response_header = abap_true.
ENDIF.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |