Привет всем,
Помогите с проблемой пожалуйста:
вот мой код, при помощи которого я передаю данные из Query (BexAnalyser 7.0 на BW)
Соединение было конечно же с BW перед вызовом Query установлено
Code:
Sub rfc_aufrufen()
Dim BW, MyFunc, ConnObject As Object
Dim oTab As SAPTableFactoryCtrl.Table
'Dim oTab As Object
Dim lRow As Long
Dim IntZeile As Integer
Dim i As Integer
Dim j As Integer
Dim tmp As Integer
tmp = 1
Set BW = CreateObject("SAP.Functions")
On Error Resume Next
Set ConnObject = Application.Run("BexAnalyzer.xla!sapbexGetConnection")
'Set ConnObject = Run("BexAnalyzer.xla!sapbexGetConnection")
If Not (ConnObject Is Nothing) Then
Set BW.Connection = ConnObject
Else
Exit Sub
End If
If Not BW.Connection.Logon(0, True) Then
MsgBox "Logon fehlgeschlagen!!!", vbCritical
Exit Sub
Else
' MsgBox "Logon erfolgreich"
End If
Set MyFunc = BW.Add("ZBW_AEND_PROTOKOLLE_SPEICHERN")
'Set MyFunc = BW.Add("ZBW_AEND_PROTOKOLLE_SPEICHERN")
Set oTab = MyFunc.Tables("T_AEND_GRUENDE")
For IntZeile = 1 To 15
If Range("F" & IntZeile) = "Änderungsnummer" Then
j = IntZeile + 1
End If
Next IntZeile
For i = j To 200
Range("N" & i).Value = Replace(Range("N" & i).Value, Chr(35), "")
If Range("N" & i) <> "" Then
oTab.AppendRow
oTab.Value(tmp, "/BIC/ZAENDNR") = "" & Cells(i, 6) & ""
oTab.Value(tmp, "/BIC/ZAENDTX1") = "" & Cells(i, 14) & ""
Cells(i, 15).Value = Replace(Cells(i, 15).Value, Chr(35), "")
oTab.Value(tmp, "/BIC/ZAENDTX2") = "" & Cells(i, 15) & ""
Cells(i, 16).Value = Replace(Cells(i, 16).Value, Chr(35), "")
oTab.Value(tmp, "/BIC/ZAENDTX3") = "" & Cells(i, 16) & ""
Cells(i, 17).Value = Replace(Cells(i, 17).Value, Chr(35), "")
oTab.Value(tmp, "/BIC/ZAENDTX4") = "" & Cells(i, 17) & ""
Cells(i, 18).Value = Replace(Cells(i, 18).Value, Chr(35), "")
oTab.Value(tmp, "/BIC/ZAENDTX5") = "" & Cells(i, 18) & ""
tmp = tmp + 1
End If
Next i
If MyFunc.Call Then
' MsgBox MyFunc.Imports("E_MESSAGE")
' MsgBox MyFunc.Call
Else
MsgBox "Aufruf fehlerhaft!!" & vbCrLf & oFunc.ReturnCode & ":" & oFunc.Exception, vbCritical
End If
On Error Resume Next
Set oTab = Nothing
Set MyFunc = Nothing
BW.Connection.Logoff
Set BW = Nothing
Set ConnObject = Nothing
End Sub
после нажатия на кнопку данные передаются успешно в BW, но если я после этого нажимаю правой мышкой на Таблицу или закрываю Еxcel таблицу, то Еxcel летит и выдаёт следующею ошибку:
EXCEPTION TABLE_NOT_ACTIVE RAISED
чтобы это могло быть?
Благодарю за помощь