I Have this code, which creates multiple excel spreadsheets, however say the first one it creates is 10 line long, the next spreadsheet created will start at line 11. How can I prevent this??
recTiogaSetup.FINDFIRST;
recVendor.RESET;
recVendor.SETRANGE("Order Book EDI", recVendor."Order Book EDI"::Excel);
IF recVendor.FINDSET THEN REPEAT
blnFound1 := FALSE;
recExcelBufferTMP.DELETEALL;
// Create Titles
CLEAR(recPurchaseOrderTMP);
recExcelBufferTMP.NewRow;
recExcelBufferTMP.AddColumn('Vendor No.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recVendor."No.",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.NewRow;
recExcelBufferTMP.AddColumn('Vendor Name',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recVendor.Name,FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.NewRow;
// Crearte Headers
recExcelBufferTMP.NewRow;
recExcelBufferTMP.AddColumn('Document No.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Type.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('No.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Description',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Manufacturing Part No.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Quantity.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Outstanding Quantity.',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Direct Unit Cost',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Line Amount',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Order Date',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Requested Receipt Date',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn('Expected Receipt Date',FALSE,'',TRUE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recPurchaseOrder.RESET;
recPurchaseOrder.SETCURRENTKEY("Buy-from Vendor No.");
recPurchaseOrder.SETRANGE("Document Type", recPurchaseOrder."Document Type"::Order);
recPurchaseOrder.SETRANGE(Status, recPurchaseOrder.Status::Released);
recPurchaseOrder.SETFILTER("Expected Receipt Date",'<%1',WORKDATE);
recPurchaseOrder.SETRANGE("Buy-from Vendor No.", recVendor."No.");
IF recPurchaseOrder.FINDSET(FALSE,FALSE) THEN REPEAT
recPurchaseOrder."Last Chased" := CURRENTDATETIME;
recPurchaseOrder.MODIFY;
recPurchaseOrderLines.RESET;
recPurchaseOrderLines.SETRANGE("Document No.", recPurchaseOrder."No.");
recPurchaseOrderLines.SETRANGE(Type, recPurchaseOrderLines.Type::Item);
recPurchaseOrderLines.SETFILTER("Outstanding Quantity", '>%1', 0);
// Input Information
IF recPurchaseOrderLines.FINDSET(FALSE,FALSE) THEN REPEAT
blnFound1 := TRUE;
recPurchaseOrderLines.CALCFIELDS("Manufacturer Part No."); // TIO000016
recExcelBufferTMP.NewRow;
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Document No.",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines.Type,FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."No.",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines.Description,FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Manufacturer Part No.",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines.Quantity,FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Outstanding Quantity",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Direct Unit Cost",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Line Amount",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Order Date",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Requested Receipt Date",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
recExcelBufferTMP.AddColumn(recPurchaseOrderLines."Expected Receipt Date",FALSE,'',FALSE,FALSE,FALSE,'',recExcelBufferTMP."Cell Type"::Text);
UNTIL recPurchaseOrderLines.NEXT = 0;
recPurchaseOrderTMP := recPurchaseOrder;
UNTIL recPurchaseOrder.NEXT = 0;
VendorCreateExcel(recPurchaseOrderTMP, blnFound1, recExcelBufferTMP);
CLEAR(recPurchaseOrderTMP);
UNTIL recVendor.NEXT = 0;
*This post is locked for comments
Please share the solution which may help in future..
Resolved!
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156