Hi all,
Please help me out in saving the Quotation Report as pdf to a local drive.
I am getting the below error while running the job where I have written code for saving the report as pdf to a local drive. Please let me know what am I doing wrong ?
Please find my code as Below :
static void KTI_BusinessConnector(Args _args)
{
KTI_SalesTempQuotation kti_SalesQuotation;
Args args = new Args();
PrintJobSettings pjs = new PrintJobSettings();
SysReportRun reportRun;
filename mFile;
QuotationId qId;
;
mFile = "C:\\MyFile.pdf";
winapi::deleteFile(mFile);
pjs.fileName(mFile);
pjs.format(PrintFormat::PDF);
pjs.setTarget(PrintMedium::File);
pjs.preferredFileFormat(PrintFormat::PDF);
//Set a preferred printer so the pdf looks normal when the default of the user is
//a strange printer (like a dot matrix label printer)
// pjs.deviceName(BCSalesQuotation_v1_02::.PrinterEmulationPDF);
args.name(reportstr("BCSalesQuotation_v1_02"));
while Select forupdate kti_SalesQuotation
where kti_SalesQuotation.UserInformation == XUserInfo::find(false, curUserId()).name
{
if(kti_SalesQuotation)
{
ttsbegin;
kti_SalesQuotation.delete();
ttscommit;
}
}
kti_SalesQuotation.clear();
qId = 'QT-00085276';
//select kti_SalesQuotation;
ttsbegin;
kti_SalesQuotation.UserInformation = XUserInfo::find(false, curUserId()).name;
kti_SalesQuotation.SalesQuotationNo = qId;
kti_SalesQuotation.insert();
ttscommit;
args.record(kti_SalesQuotation);
reportRun = classFactory.reportRunClass(args);
reportRun.printJobSettings(pjs.packPrintJobSettings());
reportRun.query().interactive(false);
reportRun.report().interactive(false);
reportRun.init();
reportRun.run();
}
Error am getting as below :
Error:
Error executing code: The field with ID '0' does not exist in table 'CustQuotationJour'.
Stack trace
(S)\Classes\RecordSortedList\first
(C)\Reports\BCSalesQuotation_v1_02\Methods\init - line 33
(C)\Jobs\KTI_BusinessConnector - line 52
Please do the needful
Thanks and regards,
Mania