on 2016 Feb 23 1:41 PM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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:
ObjectReferenceIfc | getParentObjRef() getter for hierarchical parent reference |
void |
setter for hierarchical parent reference |
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.