SalesInvoiceHeader_LT.SETRANGE(Archived,FALSE); IF SalesInvoiceHeader_LT.FINDSET THEN BEGIN REPEAT CLEAR(PrintSalesInvoice_LR); PrintSalesInvoiceHeader_LT.GET(SalesInvoiceHeader_LT."No."); PrintSalesInvoiceHeader_LT.SETRECFILTER; PrintSalesInvoice_LR.SETTABLEVIEW(PrintSalesInvoiceHeader_LT); IF PrintSalesInvoice_LR.SAVEASPDF('E:\Rechnungsarchiv\'+PrintSalesInvoiceHeader_LT."No."+'.pdf') THEN BEGIN PrintSalesInvoiceHeader_LT.GET(SalesInvoiceHeader_LT."No."); PrintSalesInvoiceHeader_LT.Archived := TRUE; PrintSalesInvoiceHeader_LT."Archived At" := CURRENTDATETIME; IF PrintSalesInvoiceHeader_LT.MODIFY THEN; Count_L += 1; END; CLEAR(PrintSalesInvoice_LR); UNTIL (SalesInvoiceHeader_LT.NEXT = 0); END;