cancel
Showing results for 
Search instead for 
Did you mean: 

Determine orgunits with common root organisation

Former Member
0 Kudos
262

Hello there,

I am trying to fill an internal table with org units, which have been downloaded from SAP HR to CRM. I found 2 tables, HRP1000 and HRP1001, which store all orgunits and their relations. As we have manually added some virtual service organisations in ppoma_crm, it ist not possible to differentiate between orgunits coming from HR and those which were manually added.

My idea is to read the complete tree recursively in a program, starting with the root of the HR organisation, but I don't understand the data structure of org management (espacially relations between infotypes) nor do I know, which functions to use.

Can anybody help me ?

Thanks and kind regards

Andreas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Andreas,

To get all the org units, you can use the following code:

DATA: org_units LIKE bapi_objec OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'BAPI_PDOTYPES_GETDETAILEDLIST'

EXPORTING

  • PLANVERSION =

objecttype = 'O'

  • STARTDATE = '19000101'

  • ENDDATE = '99991231'

  • PLANNINGSTATUS =

  • LANGUAGE = SY-LANGU

  • LANGUAGEISO =

  • IMPORTING

  • RETURN =

TABLES

objects = org_units.

Let me know if this is what you need.

Cheers,

Kelvin

Former Member
0 Kudos

Hi Kelvin,

thank you for your immediate answer.

This doesn't work, because it returns all org units, regardless which root organisation belongs to the org unit. The result is the same as a select * from hrp1000.

We have more than one root in ppoma, one for the HR organisation, one for vendors and one for our virtual service organisation. Employees can have multiple relations to orgunits, for example one to a HR org and one or more to service orgs. I only want to read the HR one to determine the name of the unit.

But your function directed me to package SP00, there I found function HR_STRUCTURE_GET which returns a table of orgunits, starting with a leaf going back to the root.

It works like this:

data: it_result_objects type objec_t.

CALL FUNCTION 'HR_STRUCTURE_GET'

EXPORTING

ROOT_PLVAR = '01'

ROOT_OTYPE = 'O'

ROOT_OBJID = '50000630'

BEGDA = SY-DATUM

ENDDA = SY-DATUM

pathid = 'O-O'

  • PATHID_IS_INTERN =

STRU_TECH_DEPTH = 0

STRU_STATUS_VECTOR = '1'

  • STRU_STATUS_OVERLAP = ' '

PROVIDE_TEXT = 'X'

PROVIDE_RELAT = 'X'

PROVIDE_DFLAG = 'X'

RECURSION_CHECK = 'X'

AUTHORITY_CHECK = 'X'

TEXT_BUFFER_FILL = 'X'

READ_MODE = 'F'

  • KEEP_ORDER =

IMPORTING

RESULT_OBJECTS = it_result_objects

  • RESULT_STRUCTURE =

  • ROOT_COPY =

EXCEPTIONS

PLVAR_NOT_FOUND = 1

ROOT_NOT_FOUND = 2

PATH_NOT_FOUND = 3

INTERNAL_ERROR = 4

OTHERS = 5

.

In it_result_objects, the first entry is the leaf org I was starting from, the last entry is the root org. So I can determine the root org an check, if it is the HR root org.

I think, this will help me along.

Thank you and regards

Andreas

Answers (0)