How can I get all org. units that a BP belongs to?
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'
act_otype = 'O'
act_objid = lv_plogi-objid
act_wegid = 'OO-S-BP' "or DISPO_BP
result_objec = gt_objects
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?
Richard Pietsch replied
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.