MS_SAP
This commit is contained in:
29
app/DD-Record-Organiser/frmSAP_FuBa.Designer.vb
generated
29
app/DD-Record-Organiser/frmSAP_FuBa.Designer.vb
generated
@@ -82,6 +82,8 @@ Partial Class frmSAP_FuBa
|
||||
Me.lblConnectionopen = New System.Windows.Forms.Label()
|
||||
Me.lblResult = New System.Windows.Forms.Label()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.txtLimitRows = New System.Windows.Forms.TextBox()
|
||||
GUIDLabel = New System.Windows.Forms.Label()
|
||||
NAMELabel = New System.Windows.Forms.Label()
|
||||
COMMENTLabel = New System.Windows.Forms.Label()
|
||||
@@ -246,9 +248,9 @@ Partial Class frmSAP_FuBa
|
||||
WHERE_CLAUSELabel.AutoSize = True
|
||||
WHERE_CLAUSELabel.Location = New System.Drawing.Point(184, 189)
|
||||
WHERE_CLAUSELabel.Name = "WHERE_CLAUSELabel"
|
||||
WHERE_CLAUSELabel.Size = New System.Drawing.Size(77, 13)
|
||||
WHERE_CLAUSELabel.Size = New System.Drawing.Size(430, 13)
|
||||
WHERE_CLAUSELabel.TabIndex = 83
|
||||
WHERE_CLAUSELabel.Text = "where clause:"
|
||||
WHERE_CLAUSELabel.Text = "where clause: (e.g. SAP_OBJECT EQ '<ObjectType>' AND AR_DATE GE '<AR_DATE>')"
|
||||
'
|
||||
'DD_ECMAdmin
|
||||
'
|
||||
@@ -642,11 +644,32 @@ Partial Class frmSAP_FuBa
|
||||
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||
Me.Button1.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Label1
|
||||
'
|
||||
Me.Label1.AutoSize = True
|
||||
Me.Label1.ForeColor = System.Drawing.Color.Brown
|
||||
Me.Label1.Location = New System.Drawing.Point(824, 69)
|
||||
Me.Label1.Name = "Label1"
|
||||
Me.Label1.Size = New System.Drawing.Size(92, 13)
|
||||
Me.Label1.TabIndex = 89
|
||||
Me.Label1.Text = "Limit RowCount:"
|
||||
'
|
||||
'txtLimitRows
|
||||
'
|
||||
Me.txtLimitRows.ForeColor = System.Drawing.Color.Brown
|
||||
Me.txtLimitRows.Location = New System.Drawing.Point(827, 85)
|
||||
Me.txtLimitRows.Name = "txtLimitRows"
|
||||
Me.txtLimitRows.Size = New System.Drawing.Size(75, 22)
|
||||
Me.txtLimitRows.TabIndex = 90
|
||||
Me.txtLimitRows.Text = "1000"
|
||||
'
|
||||
'frmSAP_FuBa
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(983, 679)
|
||||
Me.Controls.Add(Me.txtLimitRows)
|
||||
Me.Controls.Add(Me.Label1)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Controls.Add(Me.lblResult)
|
||||
Me.Controls.Add(Me.lblConnectionopen)
|
||||
@@ -745,4 +768,6 @@ Partial Class frmSAP_FuBa
|
||||
Friend WithEvents lblConnectionopen As System.Windows.Forms.Label
|
||||
Friend WithEvents lblResult As System.Windows.Forms.Label
|
||||
Friend WithEvents Button1 As System.Windows.Forms.Button
|
||||
Friend WithEvents Label1 As System.Windows.Forms.Label
|
||||
Friend WithEvents txtLimitRows As System.Windows.Forms.TextBox
|
||||
End Class
|
||||
|
||||
@@ -39,8 +39,8 @@ Public Class frmSAP_FuBa
|
||||
Dim con As New R3Connection
|
||||
Try
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
ClassLogger.Add("", False)
|
||||
ClassLogger.Add(">> SAP Connect started:", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP Connect started:", False)
|
||||
ERPConnect.LIC.SetLic("W86DWC992C")
|
||||
con.Host = HostTextBox.Text
|
||||
con.SystemNumber = SystemNumberTextBox.Text
|
||||
@@ -48,16 +48,17 @@ Public Class frmSAP_FuBa
|
||||
con.Password = PasswordTextBox.Text
|
||||
con.Client = ClientTextBox.Text
|
||||
con.Language = LanguageTextBox.Text
|
||||
ClassLogger.Add(">> HOST: " & HostTextBox.Text & " |SystemNumber: " & SystemNumberTextBox.Text & " |UserName: " & UserNameTextBox.Text & " |Password: " & PasswordTextBox.Text & " |Client: " & ClientTextBox.Text & " |Language: " & LanguageTextBox.Text, False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> HOST: " & HostTextBox.Text & " |SystemNumber: " & SystemNumberTextBox.Text & " |UserName: " & UserNameTextBox.Text & " |Password: " & PasswordTextBox.Text & " |Client: " & ClientTextBox.Text & " |Language: " & LanguageTextBox.Text, False)
|
||||
con.Open(False)
|
||||
ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||
ClassLogger.Add("", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
lblConnectionopen.Visible = True
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
||||
lblConnectionopen.Visible = False
|
||||
Me.Cursor = Cursors.Default
|
||||
lblResult.Visible = False
|
||||
GridControl2.DataSource = Nothing
|
||||
Exit Sub
|
||||
End Try
|
||||
Try
|
||||
@@ -77,7 +78,10 @@ Public Class frmSAP_FuBa
|
||||
' table.AddCriteria("SPRAS = 'DE'")
|
||||
|
||||
table.TableName = TableNameTextBox.Text
|
||||
table.RowCount = 1000
|
||||
If txtLimitRows.Text <> "" Then
|
||||
table.RowCount = CInt(txtLimitRows.Text)
|
||||
End If
|
||||
|
||||
|
||||
table.Run()
|
||||
|
||||
@@ -94,11 +98,18 @@ Public Class frmSAP_FuBa
|
||||
' ClassLogger.Add(">> " & row.Item(0).ToString & "|" & row.Item(1).ToString & "|" & row.Item(2).ToString)
|
||||
'Next
|
||||
con.Close()
|
||||
If txtLimitRows.Text <> "" Then
|
||||
lblResult.Text = "Result of FuBa (limited to " & txtLimitRows.Text & " rows)"
|
||||
Else
|
||||
lblResult.Text = "Result of FuBa (unlimited) >> " & resulttable.Rows.Count & " rows retreived"
|
||||
End If
|
||||
lblResult.Visible = True
|
||||
Me.Cursor = Cursors.Default
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in SAP Table Result: " & ex.Message, MsgBoxStyle.Critical)
|
||||
lblResult.Visible = False
|
||||
Me.Cursor = Cursors.Default
|
||||
GridControl2.DataSource = Nothing
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -117,8 +128,8 @@ Public Class frmSAP_FuBa
|
||||
Dim con As New R3Connection
|
||||
Try
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
ClassLogger.Add("", False)
|
||||
ClassLogger.Add(">> SAP Connect started:", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP Connect started:", False)
|
||||
ERPConnect.LIC.SetLic("W86DWC992C")
|
||||
con.Host = HostTextBox.Text
|
||||
con.SystemNumber = SystemNumberTextBox.Text
|
||||
@@ -126,10 +137,10 @@ Public Class frmSAP_FuBa
|
||||
con.Password = PasswordTextBox.Text
|
||||
con.Client = ClientTextBox.Text
|
||||
con.Language = LanguageTextBox.Text
|
||||
ClassLogger.Add(">> HOST: " & HostTextBox.Text & " |SystemNumber: " & SystemNumberTextBox.Text & " |UserName: " & UserNameTextBox.Text & " |Password: " & PasswordTextBox.Text & " |Client: " & ClientTextBox.Text & " |Language: " & LanguageTextBox.Text, False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> HOST: " & HostTextBox.Text & " |SystemNumber: " & SystemNumberTextBox.Text & " |UserName: " & UserNameTextBox.Text & " |Password: " & PasswordTextBox.Text & " |Client: " & ClientTextBox.Text & " |Language: " & LanguageTextBox.Text, False)
|
||||
con.Open(False)
|
||||
ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||
ClassLogger.Add("", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
||||
Me.Cursor = Cursors.Default
|
||||
@@ -153,11 +164,14 @@ Public Class frmSAP_FuBa
|
||||
' table.AddCriteria("SPRAS = 'DE'")
|
||||
|
||||
table.TableName = TableNameTextBox.Text
|
||||
If txtLimitRows.Text <> "" Then
|
||||
table.RowCount = CInt(txtLimitRows.Text)
|
||||
End If
|
||||
table.Run()
|
||||
|
||||
resulttable = table.Result
|
||||
ClassLogger.Add(">> resulttable created!", False)
|
||||
ClassLogger.Add("", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> resulttable created!", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
|
||||
Catch ex As Exception
|
||||
Me.Cursor = Cursors.Default
|
||||
@@ -185,9 +199,10 @@ Public Class frmSAP_FuBa
|
||||
End If
|
||||
|
||||
'Die Tabelle anlegen
|
||||
ClassLogger.Add(">> Create Table: " & createtablesql, False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Create Table: " & createtablesql, False)
|
||||
If ClassDatabase.Execute_non_Query(createtablesql) = False Then
|
||||
Me.Cursor = Cursors.Default
|
||||
MsgBox("Error while creating the temporary table. Please check the logfile!", MsgBoxStyle.Critical)
|
||||
Exit Sub
|
||||
End If
|
||||
Try
|
||||
@@ -200,18 +215,19 @@ Public Class frmSAP_FuBa
|
||||
Using bulkCopy As SqlBulkCopy = _
|
||||
New SqlBulkCopy(SQLconnect)
|
||||
bulkCopy.DestinationTableName = tablename
|
||||
|
||||
Try
|
||||
' Write from the source to the destination.
|
||||
bulkCopy.WriteToServer(resulttable)
|
||||
|
||||
Catch ex As Exception
|
||||
Console.WriteLine(ex.Message)
|
||||
MsgBox("Unexpected Error in BulkCopy SQL: " & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Using
|
||||
SQLconnect.Close()
|
||||
Me.Cursor = Cursors.Default
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Create table from SAP FuBa was successfull " & resulttable.Rows.Count & " Rows were inserted to table '" & tablename & "'!", False)
|
||||
MsgBox("Create table was successfull! " & vbNewLine & resulttable.Rows.Count & " Rows were inserted to table '" & tablename & "'!", MsgBoxStyle.Information)
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in Get SAP Table Result: " & ex.Message, MsgBoxStyle.Critical)
|
||||
MsgBox("Unexpected Error in SQL bulkCopy: " & ex.Message, MsgBoxStyle.Critical)
|
||||
Me.Cursor = Cursors.Default
|
||||
End Try
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user