Hallo, nachdem ich gestern im Management Studio die SQL View aufgebaut habe soll ich diese heute über einen Report => Codeunit, der eine Codunit anstößt, aufrufen. Sprich die Codeunit stößt den Import der Daten aus der View in einen Table an. Da hakt es leider auch schon bei mir. Habt ihr irgendwelche Tips?
- Code: Alles auswählen
DialogMGT_LC.OpenDialog(5,'Export der Daten');
startConn;
SQL_L := 'IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(' +
Text002_L+ '[dbo].[' + 'RechnungGutschrift_' + USERID + ']' + Text002_L + ')';
adoConnection_2.Execute(SQL_L); DialogMGT_LC.UpdateDialog(0);
SQL_L := 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; ' +
'Select * ' +
' INTO [IWASNAV_Reports].dbo. ' + 'RechnungGutschrift_' + USERID + ' FROM [';
//FW KD191 15.06.16...
MiscSetup_LT.GET;
SQL_L += 'A_RechnungGutschrift';
SQL_L += '] WHERE 1=1 ';
CREATE(ADORecordset);
ADORecordset.ActiveConnection := adoConnection;
ADORecordset.CursorType:= 3;
ADORecordset.Open(SQL_L);
DialogMGT_LC.UpdateDialog(0);
adoConnection.Close;
adoConnection_2.Close;
DialogMGT_LC.UpdateDialog(0);
// ExcelAnwendung starten
ExcelExportSetup_LT.GET;
ExcelManagement_LC.openExcel();
// Makroarbeitsmappe öffnen
// ManagementFile_L := ExcelExportSetup_LT."Path to Template" + ExcelExportSetup_LT."Template Excel Management";
// ExcelManagement_LC.openWorkbookByFile(ManagementFile_L);
// Mappe mit Vorlage öffnen
TemplateFile_L := ExcelExportSetup_LT."Path to Template" + ExcelExportSetup_LT."Template Sales Line Statistic2";
WorkFile_L := 'C:\temp\' + USERID + '_' + ExcelExportSetup_LT."Template Sales Line Statistic2";
COPY(TemplateFile_L,WorkFile_L);
ExcelManagement_LC.newWorkbook(WorkFile_L);
DialogMGT_LC.UpdateDialog(0);
ERROR('Hallo3');
{SQL_L := 'Select * from [iwas_Reports].dbo. ' + 'RechnungGutschrift_' + USERID ; }
ExcelManagement_LC.runMacro('Workbook.ImportTableInPivot',SQL_L);
// ExcelManagement_LC.closeWorkbookByName(ExcelExportSetup_LT."Template Excel Management");
DialogMGT_LC.UpdateDialog(0);
DialogMGT_LC.CloseDialog;
ExcelManagement_LC.showExcel();