DATA: lv_last_logon_date TYPE xuldate,
lv_days TYPE vtbbewe-atage,
ls_date TYPE bapilogond,
ls_flag TYPE bapilogonx,
lt_return TYPE bapiret2_t,
lv_dat TYPE dats,
lv_sysid LIKE sy-sysid.
*DATA: lt_task_type type ty_task_type occurs 0 with header line,
* task_text LIKE swwvpublic-wi_rhtext.
* Getting the last 90 days date
lv_dat = sy-datum - im_dtrdat.
* Based on the last login date fetch the user details
SELECT bname,trdat,ustyp,class FROM usr02
INTO TABLE @DATA(lt_user)
WHERE ( trdat LE @lv_dat AND ustyp = 'A' AND CLASS LIKE 'GRC%').
delete lt_user WHERE trdat is INITIAL.
** Function module to get the SYSTEMID
CALL FUNCTION 'MSS_GET_SY_SYSID'
IMPORTING
sapsysid = lv_sysid.
IF lt_user IS NOT INITIAL.
LOOP AT lt_user ASSIGNING FIELD-SYMBOL(<fs_user>).
APPEND INITIAL LINE TO et_return ASSIGNING FIELD-SYMBOL(<ls_return>).
***--Update user valid to date
ls_date-gltgb = sy-datum.
ls_flag-gltgb = 'X'.
CALL FUNCTION 'BAPI_USER_CHANGE'
EXPORTING
username = <fs_user>-bname
logondata = ls_date
logondatax = ls_flag
TABLES
return = lt_return.
IF sy-subrc EQ 0.
<ls_return>-userid = <fs_user>-bname.
<ls_return>-last_logon = <fs_user>-trdat.
<ls_return>-ustyp = <fs_user>-ustyp.
<ls_return>-class = <fs_user>-class.
<ls_return>-systemid = lv_sysid.
<ls_return>-status = 'User' && | | && <fs_user>-bname && | | && 'Expried-Contact system Administator For Logon'.
ELSE.
<ls_return>-userid = <fs_user>-bname.
<ls_return>-last_logon = <fs_user>-trdat.
<ls_return>-ustyp = <fs_user>-ustyp.
<ls_return>-systemid = lv_sysid.
READ TABLE lt_return INTO DATA(ls_return) WITH KEY type = 'E'.
IF sy-subrc = 0.
<ls_return>-status = ls_return-message .
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDFUNCTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |