C# AccpacPrintSetup with SignonSession

AccpacReport rpt = Program.session.ReportSelect("OEINV01[C://SAGE//Sage  ERP 300//OE61A//ENG//GST-CHUANLEEHININVNEW3B.RPT]", "      ", "      ");
                AccpacPrintSetup rptPrintSetup = Program.session.GetPrintSetup("      ", "      ");      // the record show error      AccpacPrintSetup is not available when accessing a remote Sage 300 ERP server
                rptPrintSetup.DeviceName = "FX DC-II C4300 PCL";
                rptPrintSetup.OutputName = "192.168.1.160_1";
                rptPrintSetup.Orientation = 1;
                rptPrintSetup.PaperSize = 9;
                rptPrintSetup.PaperSource = 15;
                rpt.PrinterSetup(rptPrintSetup);
                rpt.SetParam("PRINTED", "1");
                rpt.SetParam("DELMETHOD", "1");
                rpt.SetParam("ECENABLED", "0");
                rpt.SetParam("DIRECTEC", "0");
                rpt.SetParam("QTYDEC", "4");
                rpt.SetParam("BOITEM", "1");
                rpt.SetParam("SORTFROM", invoiceNum);
                rpt.SetParam("SORTTO", invoiceNum);
                rpt.SetParam("SWDELMETHOD", "3");
                rpt.SetParam("SERIALLOTNUMBERS", "0");
                rpt.SetParam("PRINTKIT", "0");
                rpt.SetParam("PRINTBOM", "0");
                rpt.SetParam("RETAINAGE", "0");
                rpt.SetParam("@SELECTION_CRITERIA", "(({OEINVH.INVNUMBER} >= '" + invoiceNum + "') AND ({OEINVH.INVNUMBER} <= '" + invoiceNum + "'))");
                rpt.NumOfCopies = 1;
                rpt.Destination = tagPrintDestinationEnum.PD_PREVIEW;
                rpt.PrintDir = "";
                rpt.PrintReport();

Parents Reply
  • in reply to fengxin

    In my case, this exception was thrown when running Session.GetPrintSetup("",""): 

    AccpacPrintSetup is not available when accessing a remote Sage 300 ERP server

    I figured out the compilation profile for the application was set to x64 so I switched it to x86 and it started working. 

Children