Function that return Company Code given an Org Unit ID
As per subject, is there any such function?
I seem unable to find. Straightforward way is just select bukrs from hrp1008 using the Org Unit OBJID. However, that table only stores direct assignment. I.e. many Org Unit actually have the company code inherited from parent OU. So if my OU doesn't have account assignment, must go to its parent OU to find, if parent OU doesn't have, again must go up and search. And so on..
If there's already such function, I don't want to re-invent the wheel.