'-Begin-----------------------------------------------------------------
'
' To know the gateway service (gwserv) and host (gwhost) use TAC SMGW
' and the menu Goto > Parameters > Display and look at the attribute
' entries gateway hostname and gateway service.
'
' Insert in the file Windows\system32\drivers\etc\services the entry
' sapgw00 with 3300/tcp for sapgw00, or e.g. for sapgw99 3399/tcp.
'
' Customize with TAC SM59 the RFC destination PBTESTPROGRAM
'
'-----------------------------------------------------------------------
'-Includes------------------------------------------------------------
#Include Once "sapnwrfc.inc"
'-Function ABAPCall---------------------------------------------------
Function ABAPCall(ByVal rfcHandle As Integer, _
ByVal funcHandle As Integer, errorInfo As RFC_ERROR_INFO) _
As Integer
MessageBox(null, "ABAP call", "", MB_OK Or MB_ICONINFORMATION)
Return RFC_OK
End Function
'-Variables-----------------------------------------------------------
Dim RfcErrorInfo As RFC_ERROR_INFO
Dim connParams(3) AS RFC_CONNECTION_PARAMETER
Dim As Integer hDesc, hConn, rc
Dim As WString * 16 nProgramID, nGWHost, nGWServ
Dim As WString * 16 vProgramID, vGWHost, vGWServ
'-Main----------------------------------------------------------------
nProgramID = "PROGRAM_ID" : vProgramID = "FBTESTPROGRAM"
nGWHost = "GWHOST" : vGWHost = "ABAP"
nGWServ = "GWSERV" : vGWServ = "sapgw00"
connParams(0).name = @nProgramID : connParams(0).value = @vProgramID
connParams(1).name = @nGWHost : connParams(1).value = @vGWHost
connParams(2).name = @nGWServ : connParams(2).value = @vGWServ
hDesc = RfcCreateFunctionDesc("ABAPCall", RfcErrorInfo)
RfcErrorHandler()
If hDesc <> 0 And RfcErrorInfo.code = RFC_OK Then
RfcInstallServerFunction "", hDesc, @ABAPCall, RfcErrorInfo
RfcErrorHandler()
If RfcErrorInfo.code = RFC_OK Then
hConn = RfcRegisterServer(@connParams(0), 3, RfcErrorInfo)
RfcErrorHandler()
If hConn <> 0 And RfcErrorInfo.code = RFC_OK Then
rc = RFC_OK
While rc = RFC_OK Or rc = RFC_RETRY
rc = RfcListenAndDispatch(hConn, 4, RfcErrorInfo)
Select Case rc
Case RFC_OK
OutputDebugString("RFC_OK")
Case RFC_RETRY
OutputDebugString("RFC_RETRY")
End Select
Wend
End If
End If
End If
'-End-------------------------------------------------------------------
"-Begin-----------------------------------------------------------------
Report zFBServerTest.
Call Function 'ABAPCall' Destination 'FBTESTPROGRAM'.
"-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 |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 |