cancel
Showing results for 
Search instead for 
Did you mean: 

Exception raised due to binary context attribute

Former Member
0 Kudos

Hi Anil,

I have followed what u said.

Created a context node and a binary type attribute under it.

Placed Office control on the view and set it's data source to binary type

attribute.

Created a supply method and placed the code as per the SAP Docs.

public void supplySrc(IPrivateComp1.ISrcNode node, IPrivateComp1.IContextElement parentElement)

{

//@@begin supplySrc(IWDNode,IWDNodeElement)

ISimpleTypeModifiable mod = node.getNodeInfo().getAttribute("DocFile").getModifiableSimpleType();

ModifiableBinaryType bin = (ModifiableBinaryType) mod;

bin.setMimeType(new WebResourceType("doc", "application/octet-stream", false));

IPublicComp1.ISrcElement element=wdContext.nodeSrc().createSrcElement();

//IPrivateIOSExpertMode.ISrcElement element = wdContext.nodeSrc().createSrcElement();

wdContext.nodeSrc().addElement(element);

element.setDocFile(getBytesFromFile("C:
test.doc"));

//@@end

}

        • Created the custom method getBytesFromFile ( ) as follows...

public byte[] getBytesFromFile( java.lang.String fileName )

{

// begin getBytesFromFile

File file = new File(fileName);

IWDMessageManager mmger = wdComponentAPI.getMessageManager();

FileInputStream fis = null;

byte[] bytes = null;

try{

fis = new FileInputStream(file);

long length = file.length();

bytes = new byte[(int) length];

long bytesRead = fis.read(bytes);

if (bytesRead < length) {

mmger.reportException("Could not completely read file " + fileName, false);

}

                    • I am getting the following exception .....

500 Internal Server Error

Web Dynpro Container/SAP J2EE Engine/6.40

Failed to process request. Please contact your system administrator.

[Hide]

Error Summary

While processing the current request, an exception occured which could not be handled by the application or the framework.

If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).

Root Cause

The initial exception that caused the request to fail, was:

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(Comp1View.src.DocFile): must not modify the datatype of a mapped attribute

at com.sap.tc.webdynpro.progmodel.context.MappedAttributeInfo.getModifiableSimpleType(MappedAttributeInfo.java:117)

at com.sap.tc.webdynpro.clientserver.uielib.officecomp.impl.OfficeControl.afterHandleActionEvent(OfficeControl.java:208)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.afterApplicationModification(ClientApplication.java:1132)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.afterApplicationModification(ClientComponent.java:887)

at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doRespond(WindowPhaseModel.java:573)

... 26 more

See full exception chain for details.

                      • Can u plse trace where i went wrong and plse respond ASAP as this is an urgent requirement for me.

Thanks & Regards

Ramesh. K

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If the attribute is part of context mapping, you must modify the data type of the "mapping source" (e.g. the corresponding attribute in the component controller).

Armin