HCM Processes & Forms: Tools of the Trade - part 2: Processes & FSCNs Audit



     This is another little "Y" (local) program you can run to list all your HCM P&F processes' details in one, easy layout that "connects the dots" for you to tie together the process, workflow assigned to it, form scenario(s) assigned to it, and then details about what kind of form is used and the form's name. Again, it makes putting together documentation MUCH easier! Just as I did with backend services, it also has a "nifty" little option that allows you to list our form scenarios that are not assigned directly to processes via configuration (as they can simply be assigned to a workflow task/step via bindings). In this way, you can also get a handle on how many "other" form scenarios you might have out there...not just those you find under the process' configuration. Let's walk through some example....

Selection Screen

yhrasr_procs_screeen1.PNG

Selection made to for any process starting with "HR_PD*" (which should give us only the standard SAP PD/OM related processes) and not list unassigned form scenarios

yhrasr_procs_screeen2.PNG

Result

yhrasr_procs_screeen3.PNG

Another selection made to list all processes that start with "HIRE" and list unassigned form scenarios but only of the AIF and FPM form type

yhrasr_procs_screeen4.PNG

Results showing the unassigned form scenarios now too

yhrasr_procs_screeen5.PNG

And now what you really waited for....the code! (haha)....enjoy....

[code]
*&---------------------------------------------------------------------*
*& Report  YHRASR_PROCESSES_AUDIT
*& created by Chris Solomon
*&---------------------------------------------------------------------*
*& Local program to list all standard and custom HCM Processes & Forms
*& process and form scenario details.
*&---------------------------------------------------------------------*
REPORT YHRASR_PROCESSES_AUDIT NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
*                      DATA & TYPE DECLARATIONS                        *
*----------------------------------------------------------------------*
types: BEGIN OF asr_proc,
        process         TYPE ASR_PROCESS,
        description     TYPE ASR_PROCESS_DESCRIPTION,
        wf_template     TYPE ASR_START_PROCESS_WF_TEMPLATE,
       END OF asr_proc.

types: BEGIN OF asr_proc_fsn,
        process           TYPE ASR_PROCESS,
        form_scenario     TYPE ASR_FORM_SCENARIO,
        form_scen_vers    TYPE ASR_FORM_SCENARIO_VERSION,
        form_scen_name    TYPE ASR_FORM_SCENARIO_TEXT,
        versionid         TYPE ASR_BOL_GLOBAL_ITVERS,
        start_fsn         TYPE bool,
        form_type         TYPE ASR_FORM_TYPE,
        aif_form          TYPE FPWBFORMNAME,
       END OF asr_proc_fsn.

data: t_asr_proc TYPE TABLE OF asr_proc,
      w_asr_proc TYPE asr_proc.

data: t_asr_proc_fsn TYPE TABLE OF asr_proc_fsn,
      w_asr_proc_fsn TYPE asr_proc_fsn.

field-symbols: <asrproc> LIKE LINE OF t_asr_proc,
               <asrfsn>  LIKE LINE OF t_asr_proc_fsn.

*useful tables:
* T5ASRPROCT      : processes with description/texts
* T5ASRPRSCFORM   : Configuration Data for Start of Processes with Form (workflow, start FSCN, etc)
* T5ASRPROCFSCN   : Assignment of Form Scenarios to Processes (check validity....all FSCN not in above table)
* T5ASRFSCN       : form scenario with form type information
* T5ASRFSCNT      : text for form scenario
* T5ASRFSCNSTG    : form scenario steps
* T5ASRFSCNSTGT   : text for form scenario steps
* T5ASRFSCNSRVLNK : Assignment of Backend Services to Form Scenarios
* T5ASRFSCNSRVT   : Texts for Backend Services for Form Scenarios
* T5ASRFSCNFPMCONF: FPM configurations
data: w_t5asrprscform TYPE t5asrprscform,
      w_isr_link     TYPE T5ASRFSCNISRLNK,
      w_qisrscenario TYPE qisrscenario,
      w_fpm_configs TYPE T5ASRFSCNFPMCONF.
"counters
data: i_count       type i,
      i_sap         type i,
      i_custom      type i,
      i_sap_fscn    type i,
      i_custom_fscn type i.

constants:
  C_OT_FORM_TYPE_WDA_BOL  TYPE  ASR_FORM_TYPE    VALUE    'B',    "roadmap
  C_OT_FORM_TYPE_WDA_FPM  TYPE  ASR_FORM_TYPE    VALUE    'W',    "fpm
  C_OT_FORM_TYPE_UNKNOWN  TYPE  ASR_FORM_TYPE VALUE 'U',    "unknown
  C_OT_FORM_TYPE_ADOBE    TYPE  ASR_FORM_TYPE VALUE SPACE,  "adobe
  C_OT_FORM_TYPE_WDA_MST  TYPE  ASR_FORM_TYPE VALUE 'M'.    "mass
*----------------------------------------------------------------------*
*                        SELECTION PARAMETERS                          *
* text-001  Display only Unassigned Form Scenarios with form type:
* S_AIF      Adobe Interactive Form (AIF)
* S_FPM      Floorplan Manager Form (FPM)
* S_FSCNS    List Unassigned Form Scenarios
* S_MASS  Mass Entry Form
* S_OTH      Other
* S_PROCS    Process Name / Technical ID
* S_RMAP  Roadmap Form
*----------------------------------------------------------------------*
data: gd_ucomm type sy-ucomm.

parameters: s_procs type asr_process.
selection-screen skip 1.
parameters: s_fscns as checkbox default 'X' user-command evFscn.
selection-screen skip 1.
selection-screen begin of block blockFormType with frame title text-001.
  parameters: s_aif as checkbox default 'X' modif id g1,
              s_fpm as checkbox default 'X' modif id g1,
              s_rmap as checkbox default 'X' modif id g1,
              s_mass as checkbox default 'X' modif id g1,
              s_oth as checkbox default 'X' modif id g1.
selection-screen end of block blockFormType.

AT SELECTION-SCREEN.
  gd_ucomm = sy-ucomm. "in order to have enable/disable of inputs, we need this for "user command" eventing

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF s_fscns = 'X' AND screen-group1 = 'G1'.
      screen-active = 1.
    ENDIF.
    IF s_fscns <> 'X' AND screen-group1 = 'G1'.
      screen-active = 0. "hide
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.
*----------------------------------------------------------------------*
*                           INITIALIZATION                             *
*----------------------------------------------------------------------*
initialization.
* set selection to wildcard
  s_procs = '*'.

*----------------------------------------------------------------------*
*                             TOP-OF-PAGE                              *
*----------------------------------------------------------------------*
top-of-page.

*----------------------------------------------------------------------*
*                         START-OF-SELECTION                           *
*----------------------------------------------------------------------*
start-of-selection.
  "get all processes
  SELECT process description from t5asrproct
         INTO CORRESPONDING FIELDS OF TABLE t_asr_proc WHERE language = sy-langu.
  "get all form scenarios
  SELECT form_scenario form_type versionid INTO CORRESPONDING FIELDS OF TABLE t_asr_proc_fsn FROM t5asrfscn.

  sort t_asr_proc BY process.
  loop at t_asr_proc assigning <asrproc>.
    "get workflow and starting form scenario
    clear w_t5asrprscform.
    select single * from T5ASRPRSCFORM into w_t5asrprscform
                    where process = <asrproc>-process
                      and begda <= sy-datum
                      and endda >= sy-datum.
    if sy-subrc = 0.
      <asrproc>-wf_template = w_t5asrprscform-wf_template.
      "add form scenario information and remember a FSCN can be used in multiple processes so we have to be careful
      READ TABLE t_asr_proc_fsn ASSIGNING <asrfsn> WITH KEY form_scenario = w_t5asrprscform-form_scenario
                                                                  process = ''.
      IF sy-subrc = 0.
        <asrfsn>-process = w_t5asrprscform-process.
        <asrfsn>-form_scen_vers = w_t5asrprscform-form_scen_vers.
        <asrfsn>-start_fsn = 'X'.
      ELSE. "if already assigned, we need to find entry, copy it and append new row
        READ TABLE t_asr_proc_fsn ASSIGNING <asrfsn> WITH KEY form_scenario = w_t5asrprscform-form_scenario.
        if sy-subrc = 0.
          w_asr_proc_fsn-form_scenario = <asrfsn>-form_scenario.
          w_asr_proc_fsn-form_type = <asrfsn>-form_type.
          w_asr_proc_fsn-versionid = <asrfsn>-versionid.
          w_asr_proc_fsn-process = w_t5asrprscform-process.
          w_asr_proc_fsn-form_scen_vers = w_t5asrprscform-form_scen_vers.
          w_asr_proc_fsn-start_fsn = 'X'.
          append w_asr_proc_fsn to t_asr_proc_fsn.
          clear w_asr_proc_fsn.
        endif.
      ENDIF.
    endif.
    "get other form scenarios related to process
    clear w_asr_proc_fsn.
    select process form_scenario form_scen_vers
                     into (w_asr_proc_fsn-process, w_asr_proc_fsn-form_scenario, w_asr_proc_fsn-form_scen_vers)
                     from T5ASRPROCFSCN
                    where process = <asrproc>-process
                      and begda <= sy-datum
                      and endda >= sy-datum.
      "add form scenario information
      READ TABLE t_asr_proc_fsn ASSIGNING <asrfsn>
                 WITH KEY form_scenario = w_asr_proc_fsn-form_scenario process = ''.
      IF sy-subrc = 0.
        <asrfsn>-process = w_asr_proc_fsn-process.
        <asrfsn>-form_scen_vers = w_asr_proc_fsn-form_scen_vers.
        <asrfsn>-start_fsn = ''.
      ELSE. "if already assigned, we need to find entry, copy it and append new row
        READ TABLE t_asr_proc_fsn ASSIGNING <asrfsn> WITH KEY form_scenario = w_t5asrprscform-form_scenario.
        if sy-subrc = 0.
          w_asr_proc_fsn-form_scenario = <asrfsn>-form_scenario.
          w_asr_proc_fsn-form_type = <asrfsn>-form_type.
          w_asr_proc_fsn-versionid = <asrfsn>-versionid.
          w_asr_proc_fsn-process = w_t5asrprscform-process.
          w_asr_proc_fsn-form_scen_vers = w_t5asrprscform-form_scen_vers.
          w_asr_proc_fsn-start_fsn = 'X'.
          append w_asr_proc_fsn to t_asr_proc_fsn.
          clear w_asr_proc_fsn.
        endif.
      ENDIF.
    endselect.
  endloop.

  "get form scenario details for processes
  loop at t_asr_proc_fsn assigning <asrfsn>.
    "get text if possible
    SELECT SINGLE description FROM t5asrfscnt INTO <asrfsn>-form_scen_name
                              WHERE form_scenario = <asrfsn>-form_scenario
                                AND sprsl = sy-langu.
    "get form name
    if <asrfsn>-form_type = C_OT_FORM_TYPE_ADOBE. "Adobe
      select single form_template into <asrfsn>-aif_form from T5ASRFSCNVERPRP
                     where form_scenario = <asrfsn>-form_scenario
                       and form_scen_vers = <asrfsn>-form_scen_vers.
      "how's this for weird...if the form template is not in the T5ASR* table
      "then we find it in the 'old' ISR table. The same logic can be found in
      "method ADJUST_TABLE_T5ASRFSCNVERPRP of class CL_HRASR00_DT_FSCN_DATA
      if <asrfsn>-aif_form IS INITIAL.
        clear w_isr_link.
        SELECT SINGLE * FROM T5ASRFSCNISRLNK INTO w_isr_link WHERE form_scenario = <asrfsn>-form_scenario.
        if sy-subrc = 0.
          SELECT SINGLE template_id INTO <asrfsn>-aif_form FROM qisrscenario
                             WHERE scenario = w_isr_link-isr_scenario
                               AND version = 00000.
          IF sy-subrc NE 0.
            <asrfsn>-aif_form = '(not found)'.
          ENDIF.
        endif.
        if <asrfsn>-aif_form IS INITIAL.
          <asrfsn>-aif_form = '**** not configured ****'.
        endif.
      endif.
    endif.
  endloop.


****** DISPLAY RESULTS *************************************************************************
  write: /1 'HCM PROCESSES & FORMS (HCM P&F): Process and Form Scenario audit list'.
  skip 2.

* table header for services listing
  write: /1 'PROCESSES',
         /1 'selected list of processes sorted by process name and showing assigned/associated form scenario(s) information'.
  skip 1.
*** first line of header
  write: /93 'Start'.
  write: /1  'Process Name'.
  write:  35 'Proc. Description',
          80 'Workflow',
          93 'FSCN?',
          100 'Form Scenario',
          133 'Form Type',
          145 'Form Name (AIF) / Config Name (FPM)'.
  uline.

* display selected services
  i_count = 0. i_sap = 0. i_custom = 0.
  sort t_asr_proc BY process.
  sort t_asr_proc_fsn BY process start_fsn DESCENDING form_scenario.
  loop at t_asr_proc into w_asr_proc."write results for selected entries
    "check standard vs custom
    "lots of ASSUMPTION here as there is no clear way to discern a standard
    "SAP process (ie. the 'created by' is not 'SAP' but the name of the developer)
    "so we fall back to assuming any process that starts with a Z is custom.
    if w_asr_proc-process(1) = 'Z'.
      i_custom = i_custom + 1.
    else.
      i_sap = i_sap + 1.
    endif.

    if w_asr_proc-process CP s_procs.
        write:/1 w_asr_proc-process.
        write: 35 w_asr_proc-description,
               80 w_asr_proc-wf_template.

        "form scenario info
        loop at t_asr_proc_fsn into w_asr_proc_fsn where process = w_asr_proc-process.
            if w_asr_proc_fsn-start_fsn = 'X'.
              write: 95 w_asr_proc_fsn-start_fsn.
            else.
              write: /95 w_asr_proc_fsn-start_fsn.
            endif.
            write: 100 w_asr_proc_fsn-form_scenario.
            "form type:
            "standard values are:
            "(blank) = Adobe Form
            " W    = FPM Form
            " B    = Roadmap Form
            CASE w_asr_proc_fsn-form_type.
              WHEN C_OT_FORM_TYPE_WDA_FPM.
                write: 133 'FPM Form'.
                "get FPM config names
                clear w_fpm_configs.
                select * from T5ASRFSCNFPMCONF into w_fpm_configs
                         where form_scenario = w_asr_proc_fsn-form_scenario
                           and form_scen_vers = w_asr_proc_fsn-form_scen_vers
                           order by sequence_no.
                  if w_fpm_configs-sequence_no EQ '01'.
                    write: 145 w_fpm_configs-config_id.
                  else.
                    write: /145 w_fpm_configs-config_id.
                  endif.
                endselect.
                if sy-subrc NE 0.
                  write: 145 '**** not configured ****'.
                endif.
              WHEN C_OT_FORM_TYPE_WDA_BOL.
                write: 133 'Roadmap',
                       145 '(see Infoftype UI configuration in SPRO)'.
              WHEN C_OT_FORM_TYPE_ADOBE.
                write: 133 'Adobe (AIF)',
                       145 w_asr_proc_fsn-aif_form.
              WHEN C_OT_FORM_TYPE_WDA_MST.
                write: 133 'Mass Form'.
              WHEN OTHERS.
                write: 133 'Other'.
            ENDCASE.
        endloop.

        i_count = i_count + 1.
    endif.
  endloop.

  uline.
  write: /1 'total listed:', 15 i_count.
  skip.
  write: /1 'Total processes overall:',
         /1 i_sap, ' standard SAP processes',
         /1 i_custom, ' custom processes (assumes Z prefix)'.


if s_fscns = 'X'.
  "form scenario information
  skip.
  write: /1 'FORM SCENARIOS (UNASSIGNED)',
         /1 'The following form scenarios based on your selection of form types have been configured for HCM Processes and Forms but are not directly assigned to any process:',
         /1 '(note: This is not necessarily an issue as the form scenario is likely bound directly in workflow.)'.
  write: /6 'Country'.
  write: /5 'Specific?' , 16 'Form Scenario', 50 'Form Scenario Name', 115 'Form Type', 130 'Form Name (AIF) / Config Name (FPM)'.
  uline at /5.
  i_count = 0. "reset
  SORT t_asr_proc_fsn BY form_scenario.
  loop at t_asr_proc_fsn into w_asr_proc_fsn where process = ''.
    "check form type selections
    CASE w_asr_proc_fsn-form_type.
      WHEN C_OT_FORM_TYPE_ADOBE.
        if s_aif NE 'X'.
          continue.
        endif.
      WHEN C_OT_FORM_TYPE_WDA_FPM.
        if s_fpm NE 'X'.
          continue.
        endif.
      WHEN C_OT_FORM_TYPE_WDA_BOL.
        if s_rmap NE 'X'.
          continue.
        endif.
      WHEN C_OT_FORM_TYPE_WDA_MST.
        if s_mass NE 'X'.
          continue.
        endif.
      WHEN OTHERS.
        if s_oth NE 'X'.
          continue.
        endif.
    ENDCASE.

    i_count = i_count + 1.
    if w_asr_proc_fsn-versionid NE ''.
      write:/5 'X', '(', w_asr_proc_fsn-versionid, ')', 16 w_asr_proc_fsn-form_scenario, 50 w_asr_proc_fsn-form_scen_name.
    else.
      write:/16 w_asr_proc_fsn-form_scenario, 50 w_asr_proc_fsn-form_scen_name.
    endif.
    "form type:
    "standard values are:
    "(blank) = Adobe Form
    " W    = FPM Form
    " B    = Roadmap Form
    CASE w_asr_proc_fsn-form_type.
      WHEN C_OT_FORM_TYPE_WDA_FPM.
        write: 115 'FPM Form'.
        "get FPM config names
        clear w_fpm_configs.
        select * from T5ASRFSCNFPMCONF into w_fpm_configs
                 where form_scenario = w_asr_proc_fsn-form_scenario
                   and form_scen_vers = w_asr_proc_fsn-form_scen_vers
                   order by sequence_no.
          if w_fpm_configs-sequence_no EQ '01'.
            write: 130 w_fpm_configs-config_id.
          else.
            write: /130 w_fpm_configs-config_id.
          endif.
        endselect.
        if sy-subrc NE 0.
          write: 130 '**** not configured ****'.
        endif.
      WHEN C_OT_FORM_TYPE_WDA_BOL.
        write: 115 'Roadmap',
               130 '(see Infotype UI configuration in SPRO)'.
      WHEN C_OT_FORM_TYPE_ADOBE.
        write: 115 'Adobe (AIF)',
               130 w_asr_proc_fsn-aif_form.
      WHEN C_OT_FORM_TYPE_WDA_MST.
        write: 115 'Mass Form'.
      WHEN OTHERS.
        write: 115 'Other'.
    ENDCASE.
  endloop.
  if i_count = 0.
    write: /10 '** none **', /.
  endif.

  uline at 5.
  write: /5 'total listed:', 19 i_count.
endif.
[/code]

As always, thanks for checking it out. More "tools" coming soon! Till next time...

1 comment:

  1. Controlling the business activities which are necessary for running your business, but this is very hard task to manage the all type of activities at the mean time. For this problem solution the SAP business modules are here for you which help you to manage the all business activities from the one place and you can get this SAP modules form here https://twbs.com/.

    ReplyDelete