I believe that is is not possible to use the Report.SaveAsPDF from the Classic Client.
Could someone please confirm if this is true.
I have created a web service and with this code and when ran from a website it is fine.
Ideally I would like to run this from my classic client.
If the above is true, would it be possible to call my webservice from the classic client to create the PDF version of the report.
This would allow me to email the PDF from classic client, but it would use the nicer formatting of a RTC report.
Any suggsetions?
Thanks
John
0
Comments
You can use the Automation provided by PDF creator to save reports into PDF. I wrote numerous solutions using this software.
I even posted some code here in Tips and Tricks that you can use to generate a pdf file.
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist
http://www.navisiontech.com
It's true, you cannot use it in Classic client. But of course, you can call the WebService from within NAV classic client.
See e.g. http://mibuso.com/blogs/ara3n/2009/01/2 ... companies/
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
This is what I am after. People will be emailing orders from a website or from within NAV. This should let them both call the same service, shich runs the same report, formatted in Visual Studio.
Will look better and only one report to manage.
Will try tomorrow and let you know how I get on.
Thanks
john
Yes, mainly if it is clever, evident and easy solution like this... +good blog article...
evident + easy + good blog = bestseller
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
not for all, but for some. It's easy and clever. Good example =D>
Thanks. I will post some more ideas with this solution. Just have to get the time from somewhere.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
yeah but if you don't put this stuff in the downloads section how are we supposed to vote for it. \:D/
I have changed it and pointed to my web service, but get an error
“Http Error 401 : Unauthorised”
I have tried running it from the a client on the server, windows authentication, logged in as Administrator. Also have tried changig the web service to run as Administrator, but still getting this error.
As you probably can tell I dont know much about permissions etc.
Any suggestions.
Thanks again.
John
added user and password to this line
XmlHttp.open('POST','http://figaro:7047/DynamicsNAV/WS/CRONUS/Codeunit/WebFunctions',0, 'user',
'Password');
Now get Http Error 500: Internal Server Error
It is now saying That my function name TK_CreatePOPDF is invalid. Still digging
Possibly Progress
I had a codeunit 50000 already, so imported the fob which had overwritten my CU, renumbered it and then reimported mine.
I have ony just noticed that the renumber changed my web service to point the new number if the imported CU, not my original one.
Now works a treat,
Thanks
john
CU 50000 called web services has a function
TK_CreatePOPDF(PONo : Code[20]) : Text[1000]
PH.INIT;
PH.RESET;
PH.SETRANGE("No.", PONo);
filename := 'C:\temp\';
filename += FORMAT(CREATEGUID);
filename := DELCHR(filename, '=', '{-}');
filename += '.pdf';
REPORT.SAVEASPDF(10576, filename, PH);
EXIT(filename);
The Publish this CU as a web Service called "WebFunctions"
The add a function to the Purchase Header
CreatePDF()
IF ISCLEAR(XmlDoc) THEN
CREATE(XmlDoc);
IF ISCLEAR(XmlHttp) THEN
CREATE(XmlHttp);
XmlHttp.open('POST','http://figaro:7047/DynamicsNAV/WS/CRONUS/Codeunit/WebFunctions',0, 'username',
'password');
XmlHttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
XmlHttp.setRequestHeader('SOAPAction','TK_CreatePOPDF');
XmlHttp.setTimeouts(10000,10000,10000,0); //change last parameter to zero to wait till webservice finishes the job
XmlHttp.send('<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soap:Body><TK_CreatePOPDF xmlns="urn:microsoft-dynamics-schemas/codeunit/WebFunctions">' +
'<pONo>'+"No."+'</pONo>'+
'</TK_CreatePOPDF></soap:Body></soap:Envelope>');
IF XmlHttp.status <> 200 THEN
MESSAGE('Http Error ' + ' ' + FORMAT(XmlHttp.status) + ': ' + XmlHttp.statusText);
XmlDoc.async := FALSE;
XmlDoc.load(XmlHttp.responseBody);
XmlNode := XmlDoc.selectSingleNode('//Soap:Envelope/Soap:Body/TK_CreatePOPDF_Result/return_value/');
IF NOT ISCLEAR(XmlNode) THEN BEGIN
MESSAGE('PDF created on server in '+XmlNode.text);
END ELSE BEGIN
XmlDoc.save('C:\temp\response.xml');
HYPERLINK('C:\temp\response.xml');
ERROR(Text50002);
END;
CLEAR(XmlDoc);
CLEAR(XmlHttp)
Now NAV can call "Purchase Header".CreatePDF
The web site where some users enter PO's can call WebFunctions.TK_CreatePOPDF
I now will update this to email the PDF
Thanks for all the help
:-k alIright I'll submit this one.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I believe I attached as a text file so that users can change it to what ever object they want it to.
Thanks for the feedback. I'm sure other people will use this solution.
It sort of promotes people to upgrade to 2009.
You are welcome.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
viewtopic.php?t=31544
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thank you very much for the solution.
I have tried to implement the same but receiving an error as follows
"either the caller does not have the required permission for the specified path is read-only".
I am runing on the server with classic client and as an administrator with windows login.
With the same login I am able to acess the same folder and have full control in security.
Please let me know if you or anyone can help me on the same.
Cheers --
Swapnil
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n