'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Constants-----------------------------------------------------------
Const RFC_OK = 0
'-Sub Main------------------------------------------------------------
Sub Main()
'-Variables-------------------------------------------------------
Dim SAP, hRFC, rc, TID, hTrans, hFuncDesc, hFunc
Set SAP = CreateObject("COMNWRFC")
If Not IsObject(SAP) Then
Exit Sub
End If
hRFC = SAP.RfcOpenConnection("ASHOST=ABAP, SYSNR=00, " & _
"CLIENT=001, USER=BCUSER")
If hRFC = 0 Then
Set SAP = Nothing
Exit Sub
End If
hFuncDesc = SAP.RfcGetFunctionDesc(hRFC, "RFC_PING")
If hFuncDesc = 0 Then
rc = SAP.RfcCloseConnection(hRFC)
Set SAP = Nothing
Exit Sub
End If
hFunc = SAP.RfcCreateFunction(hFuncDesc)
If hFunc = 0 Then
rc = SAP.RfcCloseConnection(hRFC)
Set SAP = Nothing
Exit Sub
End If
If SAP.RfcGetTransactionID(hRFC, TID) <> RFC_OK Then
rc = SAP.RfcCloseConnection(hRFC)
Set SAP = Nothing
Exit Sub
End If
'qRFC
'hTrans = SAP.RfcCreateTransaction(hRFC, TID, "StefansQueue")
hTrans = SAP.RfcCreateTransaction(hRFC, TID, "")
If hTrans = 0 Then
rc = SAP.RfcCloseConnection(hRFC)
Set SAP = Nothing
Exit Sub
End If
If SAP.RfcInvokeInTransaction(hTrans, hFunc) = RFC_OK Then
If SAP.RfcSubmitTransaction(hTrans) = RFC_OK Then
'qRFC
'MsgBox "Look in TAC SMQ2 (Inbound Queue)"
MsgBox "Look in table ARFCRSTATE for TID " & TID
rc = SAP.RfcConfirmTransaction(hTrans)
End If
End If
rc = SAP.RfcDestroyTransaction(hTrans)
rc = SAP.RfcDestroyFunction(hFunc)
rc = SAP.RfcCloseConnection(hRFC)
Set SAP = Nothing
End Sub
'-Main----------------------------------------------------------------
Main()
'-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |