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.lblConnectionopen = New System.Windows.Forms.Label()
|
||||||
Me.lblResult = New System.Windows.Forms.Label()
|
Me.lblResult = New System.Windows.Forms.Label()
|
||||||
Me.Button1 = New System.Windows.Forms.Button()
|
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()
|
GUIDLabel = New System.Windows.Forms.Label()
|
||||||
NAMELabel = New System.Windows.Forms.Label()
|
NAMELabel = New System.Windows.Forms.Label()
|
||||||
COMMENTLabel = 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.AutoSize = True
|
||||||
WHERE_CLAUSELabel.Location = New System.Drawing.Point(184, 189)
|
WHERE_CLAUSELabel.Location = New System.Drawing.Point(184, 189)
|
||||||
WHERE_CLAUSELabel.Name = "WHERE_CLAUSELabel"
|
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.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
|
'DD_ECMAdmin
|
||||||
'
|
'
|
||||||
@@ -642,11 +644,32 @@ Partial Class frmSAP_FuBa
|
|||||||
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||||
Me.Button1.UseVisualStyleBackColor = True
|
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
|
'frmSAP_FuBa
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(983, 679)
|
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.Button1)
|
||||||
Me.Controls.Add(Me.lblResult)
|
Me.Controls.Add(Me.lblResult)
|
||||||
Me.Controls.Add(Me.lblConnectionopen)
|
Me.Controls.Add(Me.lblConnectionopen)
|
||||||
@@ -745,4 +768,6 @@ Partial Class frmSAP_FuBa
|
|||||||
Friend WithEvents lblConnectionopen As System.Windows.Forms.Label
|
Friend WithEvents lblConnectionopen As System.Windows.Forms.Label
|
||||||
Friend WithEvents lblResult As System.Windows.Forms.Label
|
Friend WithEvents lblResult As System.Windows.Forms.Label
|
||||||
Friend WithEvents Button1 As System.Windows.Forms.Button
|
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
|
End Class
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ Public Class frmSAP_FuBa
|
|||||||
Dim con As New R3Connection
|
Dim con As New R3Connection
|
||||||
Try
|
Try
|
||||||
Me.Cursor = Cursors.WaitCursor
|
Me.Cursor = Cursors.WaitCursor
|
||||||
ClassLogger.Add("", False)
|
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||||
ClassLogger.Add(">> SAP Connect started:", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP Connect started:", False)
|
||||||
ERPConnect.LIC.SetLic("W86DWC992C")
|
ERPConnect.LIC.SetLic("W86DWC992C")
|
||||||
con.Host = HostTextBox.Text
|
con.Host = HostTextBox.Text
|
||||||
con.SystemNumber = SystemNumberTextBox.Text
|
con.SystemNumber = SystemNumberTextBox.Text
|
||||||
@@ -48,16 +48,17 @@ Public Class frmSAP_FuBa
|
|||||||
con.Password = PasswordTextBox.Text
|
con.Password = PasswordTextBox.Text
|
||||||
con.Client = ClientTextBox.Text
|
con.Client = ClientTextBox.Text
|
||||||
con.Language = LanguageTextBox.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)
|
con.Open(False)
|
||||||
ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||||
ClassLogger.Add("", False)
|
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||||
lblConnectionopen.Visible = True
|
lblConnectionopen.Visible = True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
||||||
lblConnectionopen.Visible = False
|
lblConnectionopen.Visible = False
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
lblResult.Visible = False
|
lblResult.Visible = False
|
||||||
|
GridControl2.DataSource = Nothing
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End Try
|
End Try
|
||||||
Try
|
Try
|
||||||
@@ -77,7 +78,10 @@ Public Class frmSAP_FuBa
|
|||||||
' table.AddCriteria("SPRAS = 'DE'")
|
' table.AddCriteria("SPRAS = 'DE'")
|
||||||
|
|
||||||
table.TableName = TableNameTextBox.Text
|
table.TableName = TableNameTextBox.Text
|
||||||
table.RowCount = 1000
|
If txtLimitRows.Text <> "" Then
|
||||||
|
table.RowCount = CInt(txtLimitRows.Text)
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
table.Run()
|
table.Run()
|
||||||
|
|
||||||
@@ -94,11 +98,18 @@ Public Class frmSAP_FuBa
|
|||||||
' ClassLogger.Add(">> " & row.Item(0).ToString & "|" & row.Item(1).ToString & "|" & row.Item(2).ToString)
|
' ClassLogger.Add(">> " & row.Item(0).ToString & "|" & row.Item(1).ToString & "|" & row.Item(2).ToString)
|
||||||
'Next
|
'Next
|
||||||
con.Close()
|
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
|
lblResult.Visible = True
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Unexpected Error in SAP Table Result: " & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("Unexpected Error in SAP Table Result: " & ex.Message, MsgBoxStyle.Critical)
|
||||||
lblResult.Visible = False
|
lblResult.Visible = False
|
||||||
|
Me.Cursor = Cursors.Default
|
||||||
|
GridControl2.DataSource = Nothing
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -117,8 +128,8 @@ Public Class frmSAP_FuBa
|
|||||||
Dim con As New R3Connection
|
Dim con As New R3Connection
|
||||||
Try
|
Try
|
||||||
Me.Cursor = Cursors.WaitCursor
|
Me.Cursor = Cursors.WaitCursor
|
||||||
ClassLogger.Add("", False)
|
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||||
ClassLogger.Add(">> SAP Connect started:", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP Connect started:", False)
|
||||||
ERPConnect.LIC.SetLic("W86DWC992C")
|
ERPConnect.LIC.SetLic("W86DWC992C")
|
||||||
con.Host = HostTextBox.Text
|
con.Host = HostTextBox.Text
|
||||||
con.SystemNumber = SystemNumberTextBox.Text
|
con.SystemNumber = SystemNumberTextBox.Text
|
||||||
@@ -126,10 +137,10 @@ Public Class frmSAP_FuBa
|
|||||||
con.Password = PasswordTextBox.Text
|
con.Password = PasswordTextBox.Text
|
||||||
con.Client = ClientTextBox.Text
|
con.Client = ClientTextBox.Text
|
||||||
con.Language = LanguageTextBox.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)
|
con.Open(False)
|
||||||
ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(">> SAP-Connection erfolgreich aufgebaut!", False)
|
||||||
ClassLogger.Add("", False)
|
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("Unexpected Error in SAP Connect: " & ex.Message, MsgBoxStyle.Critical)
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
@@ -153,11 +164,14 @@ Public Class frmSAP_FuBa
|
|||||||
' table.AddCriteria("SPRAS = 'DE'")
|
' table.AddCriteria("SPRAS = 'DE'")
|
||||||
|
|
||||||
table.TableName = TableNameTextBox.Text
|
table.TableName = TableNameTextBox.Text
|
||||||
|
If txtLimitRows.Text <> "" Then
|
||||||
|
table.RowCount = CInt(txtLimitRows.Text)
|
||||||
|
End If
|
||||||
table.Run()
|
table.Run()
|
||||||
|
|
||||||
resulttable = table.Result
|
resulttable = table.Result
|
||||||
ClassLogger.Add(">> resulttable created!", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(">> resulttable created!", False)
|
||||||
ClassLogger.Add("", False)
|
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
@@ -185,9 +199,10 @@ Public Class frmSAP_FuBa
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Die Tabelle anlegen
|
'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
|
If ClassDatabase.Execute_non_Query(createtablesql) = False Then
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
|
MsgBox("Error while creating the temporary table. Please check the logfile!", MsgBoxStyle.Critical)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
Try
|
Try
|
||||||
@@ -200,18 +215,19 @@ Public Class frmSAP_FuBa
|
|||||||
Using bulkCopy As SqlBulkCopy = _
|
Using bulkCopy As SqlBulkCopy = _
|
||||||
New SqlBulkCopy(SQLconnect)
|
New SqlBulkCopy(SQLconnect)
|
||||||
bulkCopy.DestinationTableName = tablename
|
bulkCopy.DestinationTableName = tablename
|
||||||
|
|
||||||
Try
|
Try
|
||||||
' Write from the source to the destination.
|
' Write from the source to the destination.
|
||||||
bulkCopy.WriteToServer(resulttable)
|
bulkCopy.WriteToServer(resulttable)
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Console.WriteLine(ex.Message)
|
MsgBox("Unexpected Error in BulkCopy SQL: " & ex.Message, MsgBoxStyle.Critical)
|
||||||
End Try
|
End Try
|
||||||
End Using
|
End Using
|
||||||
SQLconnect.Close()
|
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
|
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
|
Me.Cursor = Cursors.Default
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user