Skip to Content

     It has been a while since I wrote a HCM P&F blog as I was nicely reminded by a few people (haha). All apologies for that. It is not that I have not been doing HCM P&F work (actually on a project now doing FPM forms/processes and supporting 2 previous clients for changes/additions/etc), but honestly,  I have been head down in learning and doing a LOT of OpenUI5 (SAPUI5) “stuff” (technical term haha). Of course, I have some OpenUI5 blogs coming, but I did have some ideas for a few HCM P&F blogs.

     I often get asked via email, Facebook messages, etc., what are some of the “tips, tricks and tools” that I use on my own HCM P&F projects. Over the course of the years doing and working with HCM P&F, I like most anyone I know that has done the same have come up with my own “tools”, shortcuts, documentation templates, naming conventions, etc. that I use to “make life easier” on my projects. I will try to share some of these…..and I won’t even charge you! haha…..furthermore, you are free to use/change them as you like as long as you make sure I am credited somewhere along the way.

     The first “tool” is a nice little “Y” report program I put together years back and have added to a little here and there. It basically list out details about all backend services (generic services) that are in a system, but does so in a nice way that ties them together with their “filter” ID, implementing class, and enhancement name all in one place (usually, you have to look in several places to do this). I like to use it either when coming onto an existing project to get a nice list/look at how many custom backend services have been written (with development objects easy to find in the listing!). It is also very nice (and I use it the most) at the end of a project to help with documentation as you can cut-n-paste or dump this out to something like Excel and do what you want with it. Finally, I added a nice little “extra” bit in there that helps you audit your services to look at it from both sides….(1) you can find what services you defined in configuration but do not have a BAdI defined for them. (2) you can find BAdIs you have defined/code but that are not used on any of the HCM P&F form scenarios (i.e. unused services).

     I can not show you a complete, “open” listing as it would show client specific information, however, I can show you the report against standard SAP information. Here is how it looks….

Selection screen

yhrasr_screeen1.PNG

Selection made to show only Basic Generic Services with a filter ID that stars with “s_hire”

yhrasr_screeen2.PNG

Results of search

yhrasr_screeen3.PNG

Scroll down and see additional information

yhrasr_screeen4.PNG

Another Listing Example

Another example showing a listing for Advanced Generic Services with filter starting with “s_” shown. Also, we selected to show “short name” for the BAdI type (displays and easier to read name for basic and advanced services).

yhrasr_screeen5.PNG

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

[code]

*&———————————————————————*

*& Report  YHRASR_BACKEND_SERVICES

*& created by Chris Solomon

*&———————————————————————*

*& Local program to list all standard and custom HCM Processes & Forms

*& backend generic and advanced services details.

*&———————————————————————*

REPORT YHRASR_BACKEND_SERVICES NO STANDARD PAGE HEADING.

*———————————————————————-*

*                      DATA & TYPE DECLARATIONS                        *

*———————————————————————-*

data: t_badi_char_cond type table of badi_char_cond, “BAdI table with filter/values

      w_badi_char_cond type badi_char_cond,

      w_badi_impl type badi_impl,

      w_tadir type tadir,”to find author

      t_t5asrfscnsrv type table of t5asrfscnsrv,

      w_t5asrfscnsrv type t5asrfscnsrv.

data: w_form_scenario type asr_form_scenario.

“counters

data: i_count      type i,

      i_sap        type i,

      i_sap_ags    type i,

      i_sap_bgs    type i,

      i_custom     type i,

      i_custom_ags type i,

      i_custom_bgs type i.

constants: c_hcmpf_gs_filter TYPE badi_filter_name VALUE ‘SERVICEID’.

*———————————————————————-*

*                        SELECTION PARAMETERS                          *

* text-001  BAdI Name

* text-002  Display BAdI type:

* P_RAD1  Both (Basic and Advanced)

* P_RAD2  Basic Generic Services only

* P_RAD3  Advanced Generic Services only

* P_RADIO1  Full Name

* P_RADIO2  Short Name

* S_FILTER  Filter Value / Service ID

* S_STDSRV  Include standard SAP objects

*———————————————————————-*

parameters: s_filter type badi_char_cond-value1.

parameters: s_stdsrv as checkbox default ‘X’.

selection-screen skip 2.

selection-screen begin of block blockBadiname with frame title text-001.

  parameters: p_radio1 RADIOBUTTON GROUP rgp1 default ‘X’,

              p_radio2 RADIOBUTTON GROUP rgp1.

selection-screen end of block blockBadiname.

selection-screen skip.

selection-screen begin of block blockBaditype with frame title text-002.

  parameters: p_rad1 RADIOBUTTON GROUP rgp2 default ‘X’,

              p_rad2 RADIOBUTTON GROUP rgp2,

              p_rad3 RADIOBUTTON GROUP rgp2.

selection-screen end of block blockBaditype.

*———————————————————————-*

*                           INITIALIZATION                             *

*———————————————————————-*

initialization.

* set selection to wildcard

  s_filter = ‘*’.

*———————————————————————-*

*                             TOP-OF-PAGE                              *

*———————————————————————-*

top-of-page.

*———————————————————————-*

*                         START-OF-SELECTION                           *

*———————————————————————-*

start-of-selection.

  select * from badi_char_cond into table t_badi_char_cond

     where filter_name = c_hcmpf_gs_filter.

  select * from t5asrfscnsrv into table t_t5asrfscnsrv where service_type = ‘GENSRV’.

* table header for services listing

  write: /1 ‘selected list of backend services sorted by BAdI Implementation name’.

  skip 1.

*** first line of header

  if p_radio1 EQ ‘X’.

    write: /1  ‘BAdI Name’.

  else.

    write: /1  ‘BAdI Type’.

  endif.

  write:  35 ‘Enhancement Name’,

          70 ‘BAdI Implementation’,

         105 ‘Filter Value’,

         135 ‘Class’,

         170 ‘Enh. Author’.

  uline.

* display selected services

  i_count = 0. i_sap = 0. i_custom = 0.

  sort t_badi_char_cond BY BADI_IMPL.

  loop at t_badi_char_cond into w_badi_char_cond.

        CLEAR: w_badi_impl, w_tadir.

        “get enhancment class and BAdI name

        select single * from badi_impl into w_badi_impl

           WHERE enhname = w_badi_char_cond-ENHNAME

             AND badi_impl = w_badi_char_cond-BADI_IMPL.

        “get author (ie. SAP or custom)

        select single * from tadir into w_tadir

           WHERE pgmid = ‘R3TR’

             AND object = ‘ENHO’

             AND obj_name = w_badi_char_cond-ENHNAME.

        “get total count of services by author

        if w_tadir-author = ‘SAP’.

          i_sap = i_sap + 1.

          If w_badi_impl-badi_name EQ ‘HRASR00GEN_SERVICE_ADVANCED’.

            i_sap_ags = i_sap_ags + 1.

          else.

            i_sap_bgs = i_sap_bgs + 1.

          endif.

        else.

          i_custom = i_custom + 1.

          If w_badi_impl-badi_name EQ ‘HRASR00GEN_SERVICE_ADVANCED’.

            i_custom_ags = i_custom_ags + 1.

          else.

            i_custom_bgs = i_custom_bgs + 1.

          endif.

        endif.

        “check if standard SAP objects selected to display

        if s_stdsrv <> ‘X’ and w_tadir-author = ‘SAP’.

          continue.

        endif.

        “check type

        if p_rad2 EQ ‘X’ and w_badi_impl-badi_name EQ ‘HRASR00GEN_SERVICE_ADVANCED’.

          continue.

        endif.

        if p_rad3 EQ ‘X’ and ( w_badi_impl-badi_name EQ ‘HRASR00GENERIC_SERVICES’

                              OR w_badi_impl-badi_name EQ ‘HRASR00GEN_SERVICE_BASIC’ ).

          continue.

        endif.

       “write results for selected entries

       IF w_badi_char_cond-VALUE1 CP s_filter.

        “check display name

        if p_radio1 EQ ‘X’.

           write:/1 w_badi_impl-badi_name.

        else.

           case w_badi_impl-badi_name.

             when ‘HRASR00GENERIC_SERVICES’ OR ‘HRASR00GEN_SERVICE_BASIC’.

               write: / ‘Basic    (GS)    ‘.

             when ‘HRASR00GEN_SERVICE_ADVANCED’.

               write: / ‘Advanced (AS) ***’.

             when others.

               write: / ‘unknown’.

           endcase.

        endif.

        write: 35 w_badi_char_cond-ENHNAME,

               70 w_badi_char_cond-BADI_IMPL,

               105 w_badi_char_cond-VALUE1,

               135 w_badi_impl-class_name,

               170 w_tadir-author.

        i_count = i_count + 1.

      ENDIF.

  endloop.

  uline.

  write: /1 ‘total listed:’, 15 i_count.

  skip.

  write: /1 ‘Total services overall:’,

         /1 i_sap, ‘ standard SAP services (Basic and Advanced)’,

         /15 i_sap_bgs, ‘basic generic services’,

         /15 i_sap_ags, ‘advanced generic services’,

         /1 i_custom, ‘ custom services (Basic and Advanced)’,

         /15 i_custom_bgs, ‘basic generic services’,

         /15 i_custom_ags, ‘advanced generic services’.

  “filter information (unused and orphaned)

  skip.

  write: /1 ‘INCOMPLETE SERVICES’,

         /1 ‘The following backend services have been defined for HCM Processes and Forms but no BAdI implementation exists that uses these as filter values:’,

         /1 ‘(i.e. these are defined but not implemented.)’.

  write: /10 ‘Filter ID’.

  uline at /10(30).

  i_count = 0. “reset

  sort t_t5asrfscnsrv.

  loop at t_t5asrfscnsrv into w_t5asrfscnsrv.

    read table t_badi_char_cond into w_badi_char_cond with key value1 = w_t5asrfscnsrv-form_scen_srv.

    if sy-subrc NE 0. “not found

      write: /10 w_t5asrfscnsrv-form_scen_srv.

      i_count = i_count + 1.

    endif.

  endloop.

  if i_count = 0.

    write:/10 ‘** none **’.

  endif.

  skip.

  write: /1 ‘UNUSED SERVICES’,

         /1 ‘The following BAdI implementations exist but are not used in any form scenarios:’,

         /1 ‘(i.e. these are defined but not used in any process.)’.

  write: /10 ‘Filter ID’ , 40 ‘Enhancement Name’.

  uline at /10(70).

  i_count = 0. “reset

  loop at t_badi_char_cond into w_badi_char_cond.

    select single form_scenario from T5ASRFSCNSRVLNK into w_form_scenario where form_scen_srv = w_badi_char_cond-value1.

    if sy-subrc NE 0.

      write: /10 w_badi_char_cond-value1, 40 w_badi_char_cond-ENHNAME.

      i_count = i_count + 1.

    endif.

  endloop.

    if i_count = 0.

    write:/10 ‘** none **’.

  endif.

[/code]

     Like I said, I will keep doing these if it is received well, and people find it worthwhile. As always, I am really just trying to ease the headaches of others as they traverse the same HCM P&F path that I have been down as well. Like always….till next time!

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply