on 06-10-2015 10:48 AM
What happened to the files of the user when a user is transferred or leaves the company?
When a user is transferred or leaves the company, all the files being processed by the user should be transferred to a new user.
Every user has seven tabs where files can be available. When the user is transferred, we recommended that all the tabs are cleared before the transfer happens.
You can transfer the files available under different tabs as follows:
• Draft tab – Files in this tab can be:
o Set to In process – you can add a new user in the workflow and sending the file to the new user
o Closed– You can use a Z Program to close all the files that are in draft status
• Substitute tab - Files in this tab can be removed by deleting the Substitution set for this user
• Shared – Files in this tab can be sent back to the user who has shared them
• Tracked – Files in this tab can be untracked by a Z Program. The system stores the details of the tracked files in the /PSINDS/A_TRACKR table. You can create a Z Program to untrack all the files that are tracked by the user
• Sent - Files in this tab remain unchanged
• Cabinet – Files in this tab can be moved to Intray. You can check the condition in Execute Action method for moving the files from cabinet to intray and create a Z Program to handle the mass movement of Cabinet files to Intray for a user
• Intray - Files in this tab need to be assigned to new user. Below is a sample implementation to handle the mass transfer of Intray files to the new user
Sample Z program for moving files from Intray of the transferred user to the inbox of new user:
Create a Program with 2 fields, From User and To User. Once they enter these entries and execute, retrieve all the files in Intray from the From User. This can done with the below code
DATA : lt_msg TYPE bapiret2_t,
lt_entity TYPE /psinds/cl_files_srv_mpc=>tt_file_intray_et.
CALL METHOD /psinds/cl_helper_file=>get_intry_items
EXPORTING
iv_type = 'IN' “Intray Entries
IMPORTING
et_items = lt_entity
ct_msg = lt_msg.
“Once you have all the Intray entries, use the below code to move the files to the new user
data :ls_search type fpmgb_s_search_criteria,
lt_search type fpmgb_t_search_criteria,
ls_msg type bapiret2,
lt_search_files type /psinds/cl_files_srv_mpc=>tt_file_search_et,
ls_search_files type /psinds/cl_files_srv_mpc=>ts_file_search_et,
ls_case_attr type bapiproptb,
lt_case_attr type table of bapiproptb,
lv_timestmp type tzntstmps,
lv_str type string,
lt_msg type bapiret2_t,
lv_msg type bapiret2-message,
wa_es_data type /psinds/cl_files_srv_mpc=>ts_fi_response_et ,
it_es_data like table of wa_es_data,
return type bapiret2,
l_flag type xfeld,
ls_file type /psinds/s_inbox_powl,
lt_texttab type table of char_132,
ls_tline type tline,
admin_rsn type ref to /psinds/cl_bl_filenotings_op ,
lt_tline type tlinetab,
ls_texttab like line of lt_texttab,
lv_uname type sy-uname,
lo_ref_overdue type ref to /psinds/cl_bl_overduelog,
lo_proute type ref to /psinds/cl_bl_process_rt ,
lv_pathid type srmwfpthid ,
lv_agent type sy-uname,
lv_wiid type sww_wiid,
ls_bmsg type bapiret2,
lt_bmsg type bapiret2_t,
lv_filetype type scmgcase_type,
lt_sendto_details type /psinds/cl_bl_process_rt=>tt_sendto_data,
ls_sendto_details like line of lt_sendto_details,
l_adminreasstrng type string,
lv_slen type i,
lv_obj type otype,
lv_user type char12,
l_plvar type plvar,
lt_result_tab type tswhactor,
lt_result_objec type objec_t,
lt_result_struc type struc_t,
ls_result_objec type objec,
lv_ufname type sy-uname,
lt_inbox type table of swr_wihdr,
lt_worklist_attr type table of swr_wiaddattr,
ls_inbox type swr_wihdr,
lss_inbox type /psinds/s_inbox_powl,
lv_retcode type sy-subrc,
lv_type(10) type c,
lv_found type boolean,
lv_guid type scmg_case_guid ,
ls_ainbox type /psinds/s_inbox_powl,
ls_param4 type /iwbep/s_mgw_name_value_pair,
ls_file_intray type /psinds/cl_files_srv_mpc=>ts_file_intray_et
.
data : lv_date(16) type c ,
lv_time(5) type c.
field-symbols : <fs_et_data> type standard table,
<fs_sr_data> type standard table,
<fs_dc_data> type standard table.
data : begin of wa_wfpthid ,
case_guid type scmg_t_case-case_guid ,
wfpthid type scmg_t_case-wfpthid ,
end of wa_wfpthid ,
it_wfpthid like table of wa_wfpthid with key case_guid.
data : begin of wa_agent_wiid ,
pathid type srmwfpthps-pathid ,
agent type srmwfpthps-agent ,
posid_wiid type srmwfpthps-posid_wiid ,
activity type srmwfpthps-activity ,
end of wa_agent_wiid ,
it_agent_wiid like table of wa_agent_wiid with key pathid .
if it_items[] is not initial.
select case_guid wfpthid
into table it_wfpthid
from scmg_t_case
for all entries in it_items
where case_guid = it_items-case_guid.
if sy-subrc = 0.
select pathid agent posid_wiid activity
into table it_agent_wiid
from srmwfpthps
for all entries in it_wfpthid
where actarea = 'SCMG'
and pathid = it_wfpthid-wfpthid
and pospast = 'I'
and delflag = '' .
endif.
endif.
lv_ufname = s_pernr1. “s_pernr1 is the From User
loop at it_items into wa_items.
clear : ls_file_intray , lv_msg , lt_inbox , wa_items_i , lt_sendto_details .
ls_file_intray-case_guid = wa_items-case_guid .
if ls_param4-value is initial.
ls_param4-value = '00000000'.
endif.
ls_file_intray-latest_end_date = '00000000'.
ls_file_intray-substitutefor = p_to_user_posid. “p_to_user_posid is the position id of the To User. This position id would be inserted in the workflow
concatenate sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum+0(4) into lv_date.
concatenate sy-uzeit+0(2) ':' sy-uzeit+2(2) into lv_time.
concatenate lv_date lv_time into lv_date separated by space.
concatenate 'This file is transferred by administrator('sy-uname') through mass transfer on '
lv_date into ls_file_intray-subst_rsn separated by space.
clear wa_wfpthid.
read table it_wfpthid into wa_wfpthid
with table key case_guid = ls_file_intray-case_guid.
read table it_agent_wiid into wa_agent_wiid
with table key pathid = wa_wfpthid-wfpthid.
if sy-subrc = 0.
read table it_items_i into wa_items_i
with table key case_guid = wa_items-case_guid.
if wa_items_i is not initial.
ls_file_intray-actdc = wa_agent_wiid-activity.
endif.
else.
ls_msg-id = '/PSINDS/FLM'.
ls_msg-number = 239.
ls_search_files-msgtype = 'E'.
* CLEAR lt_search_files.
ls_search_files-msgid = ls_msg-number.
ls_search_files-msgtype = 'E'.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
ls_search_files-msgtext = lv_msg.
append ls_search_files to lt_search_files.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
endif.
create object lo_proute
exporting
iv_pathid = wa_wfpthid-wfpthid " lv_pathid
exceptions
ex_pathid_notfound = 1.
read table it_agent_wiid into wa_agent_wiid
with table key pathid = wa_wfpthid-wfpthid .
if sy-subrc = 0.
* lv_agent = ls_position-agent.
lv_slen = strlen( wa_agent_wiid-agent ).
lv_slen = lv_slen - 2.
lv_obj = wa_agent_wiid-agent+0(2).
lv_user = wa_agent_wiid-agent+2(lv_slen).
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = lv_user
importing
output = lv_user.
lv_wiid = wa_agent_wiid-posid_wiid.
*
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
"Write the reason for the approval in the notes and also capture the overdue log
l_flag = /psinds/cl_bl_overduelog=>get_logging_state( ).
if l_flag is not initial.
create object lo_ref_overdue
exporting
iv_user = lv_uname
iv_logenable = l_flag.
if ls_file-wi_id is not initial.
call method lo_ref_overdue->check_log_wi_overdue_data
exporting
iv_wiid = lv_wiid.
endif.
endif.
l_adminreasstrng = ls_file_intray-subst_rsn.
clear lt_texttab.
call method cl_swf_utl_convert_xstring=>xstring_to_table
exporting
i_stream = l_adminreasstrng
importing
e_table = lt_texttab
exceptions
invalid_input = 1
invalid_table = 2
others = 3.
if sy-subrc <> 0.
ls_msg-id = '/PSINDS/FLM'.
ls_msg-number = 344.
ls_search_files-msgtype = 'E'.
* CLEAR lt_search_files.
ls_search_files-msgid = ls_msg-number.
ls_search_files-msgtype = 'E'.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
message lv_msg type ls_search_files-msgtype.
ls_search_files-msgtext = lv_msg.
append ls_search_files to lt_search_files.
endif.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
lv_guid = wa_items-case_guid.
clear lt_tline[].
loop at lt_texttab into ls_texttab.
ls_tline-tdformat = '*'.
ls_tline-tdline = ls_texttab.
append ls_tline to lt_tline.
endloop.
create object admin_rsn
exporting
asst_flag = ' '
im_case_guid = wa_items-case_guid " lv_guid
exceptions
open_file_error = 1
open_note_error = 2
others = 3.
if sy-subrc <> 0.
ls_msg-id = '/PSINDS/FLM'.
ls_msg-number = 352.
ls_search_files-msgtype = 'E'.
ls_search_files-msgid = ls_msg-number.
ls_search_files-msgtype = 'E'.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
message lv_msg type ls_search_files-msgtype.
ls_search_files-msgtext = lv_msg.
append ls_search_files to lt_search_files.
endif.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
call method admin_rsn->/psinds/if_bl_ofcr_op~save
exporting
im_case_guid = lv_guid
im_text_id = '0006'
im_text_tab = lt_tline
im_wfid = lv_wiid.
* changing
* ct_msg = ct_msg.
concatenate 'S' ls_file_intray-substitutefor into
ls_sendto_details-agent separated by space.
ls_sendto_details-activity = wa_agent_wiid-activity. " ls_file_intray-actdc. SFSDFSDF
if ls_file_intray-latest_end_date is initial.
ls_file_intray-latest_end_date = '00000000'.
endif.
ls_sendto_details-posid_led = ls_file_intray-latest_end_date.
ls_sendto_details-duedays = ls_file_intray-duedate.
append ls_sendto_details to lt_sendto_details.
call method lo_proute->send_to_wrapper
exporting
iv_wi_id = lv_wiid " Work item ID
it_sendto_data = lt_sendto_details " Structure for Creating Process Route Items
iv_flag_on_compwi = 'X' " Boolean Variable (X=True, -=False, Space=Unknown)
changing
ct_msg = lt_bmsg.
loop at lt_bmsg into ls_bmsg where type = 'E'.
ls_msg-id = ls_bmsg-id .
ls_msg-number = ls_bmsg-number.
ls_search_files-msgtype = ls_bmsg-type.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
message lv_msg type ls_search_files-msgtype.
ls_search_files-msgtext = lv_msg.
append ls_search_files to lt_search_files.
exit.
endloop.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
ls_ainbox-case_guid = lv_guid.
call method /psinds/cl_bl_ofcr_file_op=>delete_from_sst_inbox
exporting
iv_username = lv_ufname " Created by
is_inbox = ls_ainbox " DS:Structure for In Tray
iv_filetype = lv_filetype " Case Type
iv_case_guid = lv_guid " Technical Case Key (Case GUID)
iv_search = 'X'
changing
cs_msg = ls_bmsg.
if ls_msg is not initial.
* append ls_bmsg to ct_msg.
ls_msg-id = ls_bmsg-id .
ls_msg-number = ls_bmsg-number.
ls_search_files-msgtype = ls_bmsg-type.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
message lv_msg type ls_search_files-msgtype.
ls_search_files-msgtext = lv_msg.
append ls_search_files to lt_search_files.
endif.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
call method /psinds/cl_bl_ofcr_file_op=>delete_attach_file
exporting
iv_cfile = lv_guid " Technical Case Key (Case GUID)
* iv_afile = " Technical Case Key (Case GUID)
iv_wfid = lv_wiid " Work item ID
iv_isdelete = '' " Single-Character Flag
importing
es_msg = ls_bmsg. " Return Parameter
if ls_bmsg-type = 'E'.
* append ls_bmsg to ct_msg.
ls_msg-id = ls_bmsg-id .
ls_msg-number = ls_bmsg-number.
ls_search_files-msgtype = ls_bmsg-type.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
*
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
endif.
if lt_search_files is initial.
ls_case_attr-name = 'CHANGED_BY'.
ls_case_attr-value = lv_uname.
append ls_case_attr to lt_case_attr.
ls_case_attr-name = 'CHANGE_TIME'.
clear lv_str.
concatenate sy-datum sy-uzeit into lv_str.
lv_timestmp = lv_str.
ls_case_attr-value = lv_timestmp.
append ls_case_attr to lt_case_attr.
call function 'BAPI_CASE_CHANGEATTRIBUTES'
exporting
guid = lv_guid
importing
return = return
tables
case_attributes = lt_case_attr.
endif.
read table lt_msg into ls_msg with key type = 'E'.
if sy-subrc = 0.
wa_es_data-msg_id = ls_msg-number.
wa_es_data-msg_type = 'E'.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = ls_msg-id
number = ls_msg-number
textformat = 'HTM'
importing
message = lv_msg.
wa_es_data-msg_text = lv_msg.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
else.
wa_es_data-msg_id = 107.
wa_es_data-msg_type = 'S'.
call function 'BAPI_MESSAGE_GETDETAIL'
exporting
id = '/PSINDS/FLM'
number = 107
textformat = 'HTM'
importing
message = lv_msg.
message lv_msg type wa_es_data-msg_type.
wa_es_data-msg_text = lv_msg.
append wa_es_data to it_es_data.
if lv_msg is not initial.
wa_files-remarks = lv_msg.
modify it_files from wa_files transporting remarks
where case_guid = wa_items-case_guid.
clear lv_msg.
continue.
endif.
endif.
endif.
endloop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
10 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.