on 12-30-2009 10:50 AM
Hi everybody,
I try to solve the problem like this:
- Creating a context attribute "pdf" type byte
- Creating a view UI Element "MyPdf" type interactive form binding on the context attribute "pdf"
- Inserting the following code in the wddoinit:
IPrivateView.IcontextElement contextEle = wdContext.currentContextElement();
byte bytes = contextEle.getPdf();
try
{
File file = new File("C:/text.pdf");
FileOutputStrem os = new FileOutputStream(file);
os.write(bytes);
os.close();
contextEle.setPdf(bytes);
}
catch (IOException e)
{
e.printStackTrace();
}
I'm running it on a local machine with Netweaver 7.1 and get the following error message:
java.lang.ClassCastException: class java.lang.Byte:null incompatible with interface com.sap.......
If I delete the view UI Element there is no error message. What am I doing wrong???
I think you have to bind the "dataSource" (and if needed the "pdfSource") properties to context attributes of dictionary type "binary" which corresponds to byte[] in the code.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi friend,
check with following code i think your file path is not proper that why its not able to create or read file and giving null and null can't b cast in to byte array. and the "\" is a special character (escape sequence ) so it need to be. "//"
File file1=new File(".\\CAF_DOCs\\"
+ wdContext.currentContextElement().getResource().getResourceName());
try and let us know if issue persist further. Hope it will help.
Regards
Jeetendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm sorry but it doesn't solve the problem. The error message is the same and it only appears if I have included the interactive form in the view.
If I delete the interactive form, there is no error and it seems that the coding in the wddoinit() Method works.
I've found a simple tutorial that describes my intention. But it works on webDynpro for Abap and uses Function Modules.
http://wiki.sdn.sap.com/wiki/display/WDABAP/ASimpleWebDynproApplicationtodisplayapdffileinthebrowser+window
Anybody know a similar tutorial but for WebDynpro for Java?
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.