on 05-12-2010 2:21 PM
Hi All,
We have a scenario in which a R/3 report has to be displayed in PDF format, at front end, with the help of a webdynpro application. The data is being sent through a RFC function module. The report was working fine, but due to the upgrade of backend from 4.6C to ECC 6.0, the function module to convert data to pdf format in R/3 was not working propely.
To fix this error, we had to add a parameter of type 'Blob' in the function module, which can send the data in binary format.
I have made reqired changes in the webdynpro applicaiton to use this parameter, but it is still giving me the error " File does not begin with %PDF- "
Please help to resolve this issue.
Thanks for your time & help!
Regards,
Anupama
Hi,
I have made reqired changes in the webdynpro applicaiton to use this parameter, but it is still giving me the error " File does not begin with %PDF- "--- please post the changes you have done in the code, you can read the binary data and display repsort as a file.
Could you please check the services are running to support the PDF in portal.
Refer below link(this include backend and java side code help):-
http://wiki.sdn.sap.com/wiki/display/WDJava/Creatingpdfinthebackend
Hope this may help you....
Deepak!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi please find the code that i have added :
Hi Deepak,
thanks a lot for replying!
This is the piece of code that i haev added in component controller of the application :
I am trying to fetch the data into an array of type byte. Pdf1 is the export node from R/3.
long filelen = wdContext.nodePdf1().size();
byte[] temp1 = new byte[(int)filelen];
for (int i = 0; i < wdContext.nodePdf1().size(); i++) {
temp1 = wdContext.nodePdf1().getPdf1ElementAt(i).getContent();
}
IWDResource resource = WDResourceFactory.createCachedResource(temp1, "Job Description" + position + System.currentTimeMillis()+".pdf", WDWebResourceType.PDF);
wdContext.currentContextElement().setRolePurposeURL(resource.getUrl(WDFileDownloadBehaviour.AUTO.ordinal()));
wdComponentAPI.getMessageManager().reportSuccess("url name ....."+wdContext.currentContextElement().getRolePurposeURL());
wdContext.currentContextElement().setRolePurposeVisible(WDVisibility.VISIBLE);
For more clarifications please come back.
Regards,
Anupama
HI,
Instead of 'temp1' in the line
IWDResource resource = WDResourceFactory.createCachedResource(temp1, "Job Description" + position + System.currentTimeMillis()+".pdf", WDWebResourceType.PDF);
Try to use 'wdContext.nodePdf1().getPdf1ElementAt(i).getContent().getBytes();.
Use this sample code.. This will open an html file
String html="<html>Test<html>";
IWDResource res=WDResourceFactory.createResource(html.getBytes(),"HTML File",WDWebResourceType.HTML);
IWDWindow win = wdComponentAPI.getWindowManager().createNonModalExternalWindow(res.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()),"Title");
win.open();
Best Wishes
Idhaya R
HI Deepak,
The value for temp1 = [B@1dc4d3f (for a specific user) temp1 length = 255
temp1 is a byte array, in which i am taking the value fetched from R/3 FM sent in the form of Blob datatype.
Value supposed to be in temp1 will be different for different users.
The value of resource is =
xyz.com/wd~rps/MyRolePurpose/~wd_key22_1274071720178/Job+Description600223571274071720178.pdf?sap-wd-download=1&sap-wd-cltwndid=74f1f3ce616f11dfb2d20050568348a8&sap-wd-secure-id=74f1f3d0616f11dfc3d80050568348a85609101389&sap-wd-appwndid=74f1f3cf616f11dfb3fb0050568348a8&sap-wd-norefresh=X
The value of url is =
/xyz.com/wd~rps/MyRolePurpose/~wd_key22_1274071720178/Job+Description600223571274071720178.pdf?sap-wd-download=1&sap-wd-cltwndid=74f1f3ce616f11dfb2d20050568348a8&sap-wd-secure-id=74f1f3d0616f11dfc3d80050568348a85609101389&sap-wd-appwndid=74f1f3cf616f11dfb3fb0050568348a8&sap-wd-norefresh=X
Is the data sent from R/3 is encoded ?. The lenght of the array is displayed at 255, but i could see only 9 characters in the output.
Thanks & Regards,
Anupama
Any pointers provided would be helpful....
Regards,
Anupama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.