cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get all org. units that a BP belongs to?

former_member669881
Participant
0 Kudos

Hello,

I use in my reports this function module to get all BPs that belong to an org.unit (provided in lv_plogi-objid below):

    CALL FUNCTION 'RH_STRUC_GET'
      EXPORTING
        act_otype      = 'O'
        act_objid      = lv_plogi-objid
        act_wegid      = 'OO-S-BP' "or DISPO_BP
      TABLES
        result_objec   = gt_objects
      EXCEPTIONS
        no_plvar_found = 1
        no_entry_found = 2
        OTHERS         = 3.

But I don't know any function module to go the other way around: get all org. units that a given BP belongs to. Maybe it is the same function, but with a different value for parameter act_wegid?

Do you have any ideas?

Thanks!

Calin Barbat


Accepted Solutions (1)

Accepted Solutions (1)

richard_pietsch
Active Contributor
0 Kudos

A simple selection on table BUT050 should do it. You can check the relation type and/or combine it with BUT000 to see the business partner type. Also there's class CL_AGS_WORK_BP_INFO which has some useful methods, e.g. GET_BUPA_TEAM which delivers the assigned teams (organisations) of a business partners.

Regards, Richard

former_member669881
Participant
0 Kudos

At the core of that method, one finds:

        CALL FUNCTION 'RH_STRUC_GET'
          EXPORTING
            act_otype       = 'CP'
            act_objid       = lv_personid
            act_wegid       = 'CP-S-O'
            act_plvar       = l_plvar
            act_tflag       = space
            act_vflag       = space
            authority_check = space
          TABLES
            result_tab      = lt_result_tab
          EXCEPTIONS
            no_plvar_found  = 0
            no_entry_found  = 0
            OTHERS          = 0.

The only problem that remains, is how to get the central person lv_personid from a known BP.

Thanks!

Calin

former_member669881
Participant
0 Kudos

Suppose you have a BP and want to get the corresponding CP.

Select from table BUT000 with field PARTNER=BP and pass the field BUT000-PARTNER_GUID to the function module CRM_CENTRALPERSON_GET as parameter IV_BU_PARTNER_GUID. You get the result in parameter EV_PERSON_ID=CP .

Answers (0)