on 06-30-2015 7:11 AM
Hi All,
Recently we have upgraded our sourcing system to version 10. We have written script to delete attachment via script. It was working fine but after upgrade we are getting below error:
target exception : at Line: 474 : in file: inline evaluation of: ``import java.util.Calendar; import com.sap.odp.api.common.types.TypeFactory; im . . . '' : .delete ( docLinks .get ( i ) )
Target exception: java.lang.ClassCastException: Cannot cast class com.sap.odp.common.db.ObjectReference to class java.lang.String
Piece of code for attachment deletion:
docLinks = newMA1.getDocumentLinkList();
for(int i=0;i<docLinks.size();i++) {
docLinkLine = docLinks.get(i);
name = docLinkLine.getLinkDocId();
relationship = docLinkLine.getLinkDefinitionObjRef().getDisplayName();
if(name.equalsIgnoreCase("102_OLA_102") && relationship.equalsIgnoreCase("Master Agreement Template")) {
newMA1.getDocumentLinkList().delete(docLinks.get(i));
}
}
Please help us to resolve this issue
Hello Muthu,
I was able to reproduce the problem internally. The ClassCastException shouldn’t be happening. It’s a bug. Also, I don't believe this issue is related to upgrade to release 10.0. I see the same behavior in 9.0. In my testing, I see that the exception is being thrown but the doclink is in fact deleted from the UI and was able to save the MA successfully. Has this been your experience as well? In any case, I would suggest opening a ticket for this.
Regards,
Vikram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Prabhakar,
In Earlier versions i.e, before version 10, there is no class for document links(509), but in Version 10 we have a class for Document links and there are few methods available which can be used for your logic.
Try those methods and check.
Also Instead of "newMA1.getDocumentLinkList().delete(docLinks.get(i)); " just give "docLinks .delete(docLinks.get(i));"
and check. Ideally what you have given should work but some times bean shell script behaves wierd.
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually only one entry will be in the loop always. Its runs one time and its fails on the delete statement
I tried changing the code and got the error again
Method Invocation docLinks.delete : at Line: 474 : in file: inline evaluation of: ``import java.util.Calendar; import com.sap.odp.api.common.types.TypeFactory; im . . . '' : docLinks .delete ( docLinks .get ( i ) )
Target exception: java.lang.ClassCastException: Cannot cast class com.sap.odp.common.db.ObjectReference to class java.lang.String
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.