cancel
Showing results for 
Search instead for 
Did you mean: 

Add new document links to UDO

Former Member
0 Kudos

Hello,

I have created a UDO from an RFX and am now am trying to link the 2. I want to add a link in the RFX to the UDO and in the UDO to the RFX.

I have added the link from RFX to UDO as follows:

linkCollnRFX=doc.getDocumentLinkList();
	newMember=linkCollnRFX.create();
	newMember.setDisplayName("Test Link");

	newMember.setLinkDefinitionType(new DocLinkDefinitionTypeEnumType(1));
	newMember.setLinkDocObjRef(udoBean.getObjectReference());

	relnHome =IBeanHomeLocator.lookup(session, DocumentLinkDefinitionIBeanHomeIfc.sHOME_NAME);
	relnBean = relnHome.findUnique("RelatedSRF");

	newMember.setLinkDefinitionObjRef(relnBean.getObjectReference());

	linkCollnRFX.add(newMember);

	//save the document
	doc.getIBeanHomeIfc().save(doc);

I need to the same thing for the UDO. UserDefinedBizDoc1IBeanIfc has getAllDocumentLinks() which returns CollectionIfc. CollectionIfc has no add method. Can someone please help me understand how I can add to this collection?

Thanks,

MP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use getDocumentLinkList() which is an instance of AssociativeCollectionIfc and this has ADD method to it. if you are using the other try type casting to AssociativeCollectionIfc and try add.

Thanks,

Baski

Former Member
0 Kudos

Thanks Baski,

getDocumentLinkList() is not listed in UserDefinedBizDoc1IBeanIfc. I anyway tried and as expected got the following error

Error in method invocation: No args method getDocumentLinkList() not found in class'com.sap.odp.api.doccommon.userdefined.UserDefinedBizDoc1IBeanImpl' : at Line: 30 : in file: inline evaluation of: ``import com.sap.odp.api.doccommon.userdefined.*; import com.sap.odp.api.doccommo . . . '' : udoBean .getDocumentLinkList ( )

I also already tried casting this yesterday, I tried the following 3 methods, and all gave me the same error listed below.

	linkCollnUDO=(AssociativeCollectionIfc) udoBean.getAllDocumentLinks();
	newMemberUDO=linkCollnUDO.create();

	linkColln=udoBean.getAllDocumentLinks();
	linkCollnUDO=(AssociativeCollectionIfc) linkColln;
	newMemberUDO=linkCollnUDO.create();

	linkColln=udoBean.getAllDocumentLinks();
	AssociativeCollectionIfc linkCollnUDO=(AssociativeCollectionIfc) linkColln;
	newMemberUDO=linkCollnUDO.create();

2011-10-13 08:34:43.459 ERROR local4 ScriptManager executeToolbarScript RequestHandler.RqThread: tb_script 4D37565E1B5A849F12847A27A8ED6F5E #abc.context.id# abcadmin Toolbar (rfx.RFXDoc. ABC1) script exception: ID: Illegal cast. Cannot cast com.sap.odp.api.doccommon.userdefined.UserDefinedBizDoc1IBeanImpl$1 to com.sap.odp.api.ibean.AssociativeCollectionIfc

Am I doing something wrong? Can you help me to cast this properly?

Thanks,

MP

Former Member
0 Kudos

Hi Baski,

Any suggestions for this issue?

Thanks,

MP

Former Member
0 Kudos

Hi MP,

getAllDocumentLinks doesn't seem to return AssociativeCollectionIfc. it returns an instance of annonmous class and unfortunatley typecasting doesn't seem to be an option

if documentLinkList() method isn't available and it does seem to be an issue as it use to be in earlier releases I guess. Please raise an OSS message with SAP giving the background.

Good Luck,

Baski

Former Member
0 Kudos

Thank you Baski.

Former Member
0 Kudos

The getdocumentLinkList() was missing in On Demand 7.0 and was fixed in Version 7.0 SP2 Patch 1. Thanks to Baski for highlighting that it was available in earlier releases.

Earlier support just said that my request had been sent to Product Development to add to their backlog, but when I said it was available in earlier releases, they came back with the info that it was fixed in SP 2 Patch 1. We upgraded to Wave 8 and are all set for this issue.

Thanks,

MP

Answers (0)