Upload
arun-varshney
View
221
Download
1
Embed Size (px)
DESCRIPTION
workflow
Citation preview
10/15/2015 Workflow User Substitution Utility Code Gallery SCN Wiki
http://wiki.scn.sap.com/wiki/display/Snippets/Workflow+User+Substitution+Utility 1/3
Getting Started Newsletters Store
Search the Community
Welcome, Guest Login Register
Products Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Code Gallery
Created by Michael Arnold, last modified by Manish Kumar on Jan 05, 2014
Workflow User Substitution Utility
Author: Michael Arnold Submitted: 03/12/2007
This utility program allows the Workflow Administrator to viewand change user substitutes.You must create the following GUI status before using this program.GUI status WF_STATUSSelect Extras > Adjust template and select "List viewer"Add the following commands to the Application Toolbar: SETSUB Set Substitutes ACTSUB Activate Substitutes ORGMGT Org Management
123456789
10111213141516171819202122232425262728293031323334353637383940414243444546
*&‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐**& 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 TYPESTANDARD TABLE OF user_addr,wa_variant TYPE disvariant.*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*START‐OF‐SELECTION **‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐SELECTa~bnamea~name_firsta~name_lasta~tel_extensa~kostla~buildinga~roomnumberINTO CORRESPONDING FIELDS OF TABLE itab_user_addrFROM user_addr AS aINNER JOIN usr02 AS uON a~bname = u~bnameWHERE a~bname IN s_usersAND u~ustyp = 'A'. "Dialog users onlyMOVE sy‐repid TO wa_variant‐report.*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' **‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
10/15/2015 Workflow User Substitution Utility Code Gallery SCN Wiki
http://wiki.scn.sap.com/wiki/display/Snippets/Workflow+User+Substitution+Utility 2/3
4748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = 'ZBCWFSUB' i_callback_pf_status_set = 'SET_PF_STATUS' i_callback_user_command = 'USER_COMMAND' i_structure_name = 'USER_ADDR' i_default = 'X' i_save = 'A' is_variant = wa_variant 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‐ucommrs_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 user = l_uname 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_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
10/15/2015 Workflow User Substitution Utility Code Gallery SCN Wiki
http://wiki.scn.sap.com/wiki/display/Snippets/Workflow+User+Substitution+Utility 3/3
119120121122123124
*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*‐>EXTAB text*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐FORM set_pf_status USING extab TYPE slis_t_extab. SET PF‐STATUS 'WF_STATUS'.ENDFORM. "set_pf_status
workflow administration user substitution snippet
1 CommentGuestGreat Work! but there is a std transaction RMPS_SET_SUBSTITUTE.
Regards, IA
Follow SCNContact Us SAP Help PortalPrivacy Terms of Use Legal Disclosure Copyright