cancel
Showing results for 
Search instead for 
Did you mean: 

Finding list of all Business Partners assigned to email notification roles

Former Member
0 Kudos

We are working in CRM 7.0. I'm trying to find all Business Partners, that are assigned as an lead creation/update email recipients in our system for certain job roles - ic_agent, etc. Opening each org unit would take way too long. Thanks for any guidance you can provide.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Jorge. I have attached a shot of the data in PPOMA_CRM. I want to find every business partner assigned to the little red man with the hat throughout CRM (not just this org unit), for lack of a better way to describe it. Thank you again for your help with this.

jorge_ocamposbenito
Contributor
0 Kudos

Hi Joel,

You have to develop a function module like this:

Hi Joel,

You have to develop a function module like this:


FUNCTION ZSEARCH_EMAIL_RECIP.

  *"----------------------------------------------------------------------

*"*"Interfase local

*" IMPORTING

*" REFERENCE(P_SHORT_D) TYPE SHORT_D

*" TABLES

*" T_EMPLOYEES STRUCTURE SWHACTOR

*"----------------------------------------------------------------------

  *  Global data declarations

    DATA: lt_struc_total  TYPE TABLE OF struc,

          ls_struc_total  TYPE struc,

          ls_struc_aux    TYPE struc,

          lt_leading_pos  TYPE TABLE OF hrobject,

          ls_leading_pos  TYPE hrobject,

          lt_struc_employees  TYPE TABLE OF swhactor,

          ls_struc_employees  TYPE swhactor,

          ls_sel_object   TYPE objec.

* With this function we get the main organizational unit

   CALL FUNCTION 'RH_MACO'

     EXPORTING

       seark      = p_sigla_org

       plvar      = '01'

       otype      = 'O'

     IMPORTING

       sel_object = ls_sel_object.

* With this function we get all the structure from main org. unit.

   CALL FUNCTION 'RH_STRUC_GET'

     EXPORTING

       act_otype      = ls_sel_object-otype

       act_objid      = ls_sel_object-objid

       act_wegid      = 'OO-S-BP'

     TABLES

       result_struc   = lt_struc_total

     EXCEPTIONS

       no_plvar_found = 1

       no_entry_found = 2

       OTHERS         = 3.

* Loop over all the Organizational units behind main Org. unit.

   LOOP AT lt_struc_total INTO ls_struc_total

                         WHERE otype = 'O'.

     REFRESH: lt_leading_pos,

              lt_struc_employees.

 

* find out all the leadin position (red man!!)

     CALL FUNCTION 'RH_GET_LEADING_POSITION'

       EXPORTING

         plvar             = '01'

         otype             = ls_struc_aux-otype

         sobid             = ls_struc_aux-objid

       TABLES

         leading_pos       = lt_leading_pos

       EXCEPTIONS

         no_lead_pos_found = 1

         OTHERS            = 2.

* Loop over leading positions and get the employees.

     LOOP AT lt_leading_pos INTO ls_leading_pos.

       CALL FUNCTION 'RH_STRUC_GET'

         EXPORTING

           act_otype      = ls_leading_pos-otype

           act_objid      = ls_leading_pos-objid

           act_wegid      = 'OO-S-BP'

         TABLES

           result_tab     = lt_struc_employees

         EXCEPTIONS

           no_plvar_found = 1

           no_entry_found = 2

           OTHERS         = 3.

          LOOP AT lt_struc_employees INTO ls_struc_employees

                                WHERE otype = 'BP'.

           MOVE-CORRESPONDING ls_struc_employees TO t_employees.

           APPEND t_employees.

         ENDLOOP.

     ENDLOOP.

ENDLOOP.

SORT t_employees.

DELETE ADJACENT DUPLICATES FROM t_employees.

ENDFUNCTION.

Note: Maybe this FM has some errors, you have to adapt it.

Best regards.

Former Member
0 Kudos

Jorge,

Thank you very much for this code sample! I should be able to adapt this to my need. You've made my task much easier. I wish you a wonderful day.

Former Member
0 Kudos

Jorge i have a question about the above code. Why did you select seark = p_sigla_org in the function 'RH_MACO' ?

Thanks....Joel

jorge_ocamposbenito
Contributor
0 Kudos

Hi Joel,

Sorry, change p_sigla_org by p_short_d. P_SHORT_D is the code of the object.

In my example in P_SHORT_D parameter you have to enter the code of your main org unit.

Best regards.

Former Member
0 Kudos

Hello Jorge,

Thank you for your response. I was away from work until today to see your reply. I apolgize, but i don't quite get what you mean still, as i'm still learning this language. I'm not sure how to use the p_short_d to grab the main org unit. That's the value i need to export to SEARK in function RH_MACO right?

Thanks again for you help....Joel

jorge_ocamposbenito
Contributor
0 Kudos

Hi Joel,

Yeah, thats right. You have to get the SHORT_D of your main (the superior one) organizational unit and put it in SEARK parameter in RH_MACO.

Best regards.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you for you quick response Jorge. I may have not been clear in my question. I'm trying to find out all the users in our CRM system, assigned to the position of email notification recipient. I can manually see each one by searching in SAP GUI t-code PPOMA_CRM or through the web UI, but don't see away to pull the a list of them. Any ideas?

Thanks,

Joel

jorge_ocamposbenito
Contributor
0 Kudos

Hi Joel,

Can you send us a screenshot about the data that you want in PPOMA_CRM?

Best regards.

jorge_ocamposbenito
Contributor
0 Kudos

Hi Joel,

Each business role has a Authorization role (PFCG) assigned this PFCG role has to be assigned to the user assigned to business role. So, yo have only to open this PFCG role in PFCG transaction a find the users assigned in users tab.

Best regards.