cancel
Showing results for 
Search instead for 
Did you mean: 

Business Unit Parent on Master Agreement

Former Member
0 Kudos
106

Hi All,

we have a very simple requirement from the client which turns out to be somewhat major at it seems that all the methods that could be used are not working.

Get the Business Unit from the current document - done via getOrganizationalUnitRef

Find the Parent of said Business Unit - struggling with that - all the methods I've tried are returning error messages even though they are supposedly active (according to the Reference Guide)

Set Parent of BU into Extension - once we get that this should be a piece of cake...

Now, I've tried all methods I can find but it keeps telling me that the most basic one aren't available; such as Command not found: getParentObjRef( com.sap.odp.common.db.ObjectReference ) - which is available in the BusinessUnitIBeanIfc.

Am I missing something?

Any help is appreciated.

Thank you.

/Anita

Accepted Solutions (1)

Accepted Solutions (1)

former_member190023
Contributor
0 Kudos

Hi Anita,

Yes, something is missing there:

- the getOrganizationalUnitRef method returns an ObjectReferenceIfc, not the BusinessUnitIBeanIfc.

What you'll need to do is:


buObjRef = doc.getOrganizationalUnitRef();

buHome = IBeanHomeLocator.lookup(session, buObjRef);

businessUnit = buHome.find(buObjRef);

From the businessUnit variable you can call all methods available on BusinessUnitIBeanIfc.

PS: Good to see you around here, it's been a long time

Regards,

Bogdan Toma

Former Member
0 Kudos

Hej Hej,

it has been a while indeed. 🙂

Thank you for your suggestion, but I think they haven't exposed the methods as stated in the Reference Guide - I tried to find the parent with all the methods avaialble in the BusinessUnitIfc but I keep getting error messages. I have now opened a SAP Message, not sure if this is a bug...

'Command not found: getParentObjRef( com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanImpl )'

According to the Ref Guide that method is available and can be called, so I have no idea why it's failing.

/Anita

former_member190023
Contributor
0 Kudos

Can you post the code snippet, and let me know what version and SP you are on?

I'll be able to check further if I know more.

Bogdan

Former Member
0 Kudos

Hej Hej,

I've tried with all the methods mentioned in the BusinessUnitIfc... none of them work.

OrgUnitRef = doc.getOrganizationalUnitRef(); //OrgUnit from MA Document

OrgUnitHome = IBeanHomeLocator.lookup(session, OrgUnitRef);

OrgUnitParent = OrgUnitHome.find(OrgUnitRef);//Code is fine until here

/*Getting the Parent of the BU*/

OUParent = (ObjectReferenceIfc) OrgUnitParent.getParentObjRef(OrgUnitRef); //Command not found: getParentObjRef( com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanImpl )

We're on v9 SP19 - currently running this as a toolbar script to make testing faster.

Thank you. 🙂

/Anita

former_member190023
Contributor
0 Kudos

Ah, I see now.

Issue is that the getParentObjRef doesn't have any parameters. Last line should be

OUParent = (ObjectReferenceIfc) OrgUnitParent.getParentObjRef();


This is also in RefGuide, I think the below confusion happened:

ObjectReferenceIfcgetParentObjRef() 
           getter for hierarchical parent reference
void

setParentObjRef(ObjectReferenceIfc aHParentObjRef) 

           setter for hierarchical parent reference


Bogdan

Former Member
0 Kudos

Thank you - this solved my problem and it's working fine now 🙂

/Anita

Answers (0)