Posted: Fri Sep 07, 2007 11:49 pm Post subject: Workflow User Substitution Utility
Author: Michael Arnold
This utility program allows the Workflow Administrator to view
and change user substitutes.
You must create the following GUI status before using this program.
GUI status WF_STATUS
Select Extras --> Adjust template and select "List viewer"
Add the following commands to the Application Toolbar:
- SETSUB Set Substitutes
- ACTSUB Activate Substitutes
- ORGMGT Org Management
Code:
*&---------------------------------------------------------------------*
*& Report ZBCWFSUB
*&
*&---------------------------------------------------------------------*
*& This program allows the Workflow Administrator to change
*& user or position substitutes. The user must position the cursor
*& on the userid and then click either the "Set Substitute" or
*& "Activate Substitute" button.
*&
*& Create GUI status WF_STATUS
*& Select Extras --> Adjust template and select "List viewer"
*& Add the following commands to the Application Toolbar:
*& - SETSUB Set Substitutes
*& - ACTSUB Activate Substitutes
*& - ORGMGT Org Management
*&---------------------------------------------------------------------*
report zbcwfsub.
type-pools: slis.
tables: user_addr.
select-options: s_users for user_addr-bname.
data: itab_user_addr type table of user_addr,
wa_variant type disvariant.
start-of-selection.
select a~bname a~name_first a~name_last a~tel_extens
a~kostl a~building a~roomnumber
into corresponding fields of table itab_user_addr
from user_addr as a
inner join usr02 as u
on a~bname = u~bname
where a~bname in s_users
and u~ustyp = 'A'. "Dialog users only
move sy-repid to wa_variant-report.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = 'ZBCWFSUB'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name = 'USER_ADDR'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
is_variant = wa_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = itab_user_addr
* EXCEPTIONS
* PROGRAM_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.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* Execute the user command
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: l_uname type usr02-bname,
l_act_mode type c.
if rs_selfield-fieldname = 'BNAME'.
move rs_selfield-value to l_uname.
case r_ucomm.
when 'SETSUB'.
when 'ACTSUB'.
move 'A' to l_act_mode.
when 'ORGMGT'.
call function 'RH_USER_ORG_RELATIONS_MAINTAIN'
exporting
* ACT_PLVAR =
user = l_uname
* MAINT =
* DISPLAY_ONLY = ' '
* EXCEPTIONS
* NO_ACTIVE_PLVAR = 1
* USER_NOT_FOUND = 2
* OTHERS = 3
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
exit.
endcase.
call function 'RH_SUBSTITUTES_LIST'
exporting
us_type = 'US'
us_id = l_uname
* ACT_PLVAR =
act_begda = sy-datum
act_endda = '99991231'
maintainance_flag = ' '
act_mode = l_act_mode
* EXCEPTIONS
* NO_ACTIVE_WF_PLVAR = 1
* OTYPE_NOT_VALID = 2
* OBJECT_NOT_VALID = 3
* OTHERS = 4
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endform. "user_command
*&---------------------------------------------------------------------*
*& Form set_pf_status
*&---------------------------------------------------------------------*
* Set the GUI Status
*----------------------------------------------------------------------*
* -->EXTAB text
*----------------------------------------------------------------------*
form set_pf_status using extab type slis_t_extab.
set pf-status 'WF_STATUS'.
endform. "set_pf_status
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.