on 06-04-2009 4:38 AM
All,
We have requirement to open a PDF or DOC in a new window from a BAPI output structure. The field returned from the BAPI is a binary field. Following is the code that is implemented for this scenario.
for(int i=0;i<wdcontext.nodeOutput().nodePtx_Drao().size();i++)
{
IWDCachedWebResource resource = WDwebResource.getWebResource(wdcontext.nodeOutput().nodePtx_Drao().getPtx_DraoElementAt(i).getOrblk(), WdWebResourcetype.PDF);
}
IWDWindow win = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.OPEN_PLACE.ordinal()), "test");
win.open();
The problem we are facing here is when we try to open the PDF it throws an error saying "File does not begin with '%PDF-'". If we try to open a word document by changing the resource type some junk values are coming.
Has anyone come across this type of development issues?
Appreciate all your replies and new inputs in this regard.
Thanks & Regards,
Nagarajan.
Hi,
I also tried with the same using the below code. Even I am getting the same error.
byte[] test=new byte[9];test[0]=2;
IWDCachedWebResource resource = WDWebResource.getWebResource(test,WDWebResourceType.PDF);
When i tried the same code with other file type its working file.
IWDCachedWebResource resource = WDWebResource.getWebResource(test,WDWebResourceType.DOC);
From where are you getting this actual byte array? from R/3?. In internet if you search about this error we are getting the results like "The PDF file has a .mme extension rather than a .pdf extension".
Note: This is not the problem with Window or LinkToURL ui elments.
Posting this to give you an idea.
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charan,
Thanks. Yes Word document I was able to open but not sure that is the correct data looks like some junk values to be populated in the document.
The binary values are coming from R3 through a BAPI call. Ok let me try to put this in a Link to URL and see what happens.
Regards,
Nagarajan.
if you can shoot me a mail , i can send you the sample to help yourself
thanks
meenu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Amit - The code you have provided is for opening a popup window which is not I m looking for.
Charan - There is no special chars in the filename.
Thanks,
Nagarajan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Just try this below scenario to analyze the problem.
Create one LinkToURL ui element. And create one Context attribute "URL" and bind this attribute to the LinkToURL ui element's reference property.
Now fill the context attribute ''URL'" as below.
wdContext.currentContextElement.setURL(resource.getUrl());
Check in runtime whether it is opening the url in external browser properly or not.
Regards,
Charan
Hi,
Can you check that any special characters are there in you file name (including space char also).
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can try following :
//get the repository content at runtime of the Web-Dynpro-
// Window u201CAddressbookWindowu201D
IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI
.getComponentInfo()
.findInWindows("AddressbookWindow");
//create the u201CAddressbookWindowu201D
IWDWindow window = wdComponentAPI.getWindowManager()
.createWindow( windowInfo, true);
//set the WindowPosition on the screen
window.setWindowPosition(300, 150);
//and show the window
window.open();
// Save WindowInstance in Context
wdContext.currentPopupElement().setWindowInstance(window);
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.