'-Begin-----------------------------------------------------------------
'-Includes------------------------------------------------------------
#Include Once "cgi-util.bi"
#Include Once "sapnwrfc.inc"
'-Variables-----------------------------------------------------------
Dim RfcErrorInfo As RFC_ERROR_INFO
Dim connParams(6) AS RFC_CONNECTION_PARAMETER
Dim As Integer hRFC, hFuncDesc, hFunc, hStruct, res
Dim As ZString Ptr pASHost, pSysNr, pClient, pUser, pPassWd, pLang
Dim As WString * 16 nASHost, nSysNr, nClient, nUser, nPassWd, nLang
Dim As WString * 16 vASHost, vSysNr, vClient, vUser, vPassWd, vLang
Dim As WString * 9 SAPHost, SAPSysID
Dim As WString * 11 SAPDBSys
Dim As WString * 33 SAPDBHost
'-Macros--------------------------------------------------------------
#Macro RfcErrorHandlerCGI()
If RfcErrorInfo.code <> RFC_OK Then
Print "<h1>RFC Error Message</h1><br>"
Print RfcErrorInfo.message
End If
#EndMacro
'-Main----------------------------------------------------------------
res = cgi_init()
Print !"Content-type: text/html\n\n"
If res <> CGIERR_NONE Then
Print "Error " & Str(res) & " " & Str(cgi_strerror(res)) & "<p>"
Else
pASHost = cgi_getentrystr("ASHOST") : nASHost = "ASHOST" : vASHost = *pASHost
pSysNr = cgi_getentrystr("SYSNR") : nSysNr = "SYSNR" : vSysNr = *pSysNr
pClient = cgi_getentrystr("CLIENT") : nClient = "CLIENT" : vClient = *pClient
pUser = cgi_getentrystr("USER") : nUser = "USER" : vUser = *pUser
pPassWd = cgi_getentrystr("PASSWD") : nPassWd = "PASSWD" : vPassWd = *pPassWd
pLang = cgi_getentrystr("LANG") : nLang = "LANG" : vLang = *pLang
connParams(0).name = @nASHost : connParams(0).value = @vASHost
connParams(1).name = @nSysNr : connParams(1).value = @vSysNr
connParams(2).name = @nClient : connParams(2).value = @vClient
connParams(3).name = @nUser : connParams(3).value = @vUser
connParams(4).name = @nPassWd : connParams(4).value = @vPassWd
connParams(5).name = @nLang : connParams(5).value = @vLang
hRFC = RfcOpenConnection(@connParams(0), 8, RfcErrorInfo)
RfcErrorHandlerCGI()
If hRFC <> 0 And RfcErrorInfo.code = RFC_OK Then
hFuncDesc = RfcGetFunctionDesc(hRFC, "RFC_SYSTEM_INFO", _
RfcErrorInfo)
RfcErrorHandlerCGI()
If hFuncDesc <> 0 And RfcErrorInfo.code = RFC_OK Then
hFunc = RfcCreateFunction(hFuncDesc, RfcErrorInfo)
RfcErrorHandlerCGI()
If hFunc <> 0 And RfcErrorInfo.code = RFC_OK Then
RfcInvoke hRFC, hFunc, RfcErrorInfo
RfcErrorHandlerCGI()
If RfcErrorInfo.code = RFC_OK Then
RfcGetStructure hFunc, "RFCSI_EXPORT", @hStruct, _
RfcErrorInfo
RfcErrorHandlerCGI()
If RfcErrorInfo.code = RFC_OK Then
RfcGetChars hStruct, "RFCHOST", @SAPHost, 8, _
RfcErrorInfo
RfcGetChars hStruct, "RFCSYSID", @SAPSysID, 8, _
RfcErrorInfo
RfcGetChars hStruct, "RFCDBHOST", @SAPDBHost, 32, _
RfcErrorInfo
RfcGetChars hStruct, "RFCDBSYS", @SAPDBSys, 10, _
RfcErrorInfo
Print "<h1>FM RFC_SYSTEM_INFO</h1>"
Print "Host: " & SAPHost
Print "<br />"
Print "SysID: " & SAPSysID
Print "<br />"
Print "DBHost: " & SAPDBHost
Print "<br />"
Print "DBSys: " & SAPDBSys
Print "<p>"
End If
End If
RfcDestroyFunction hFunc, RfcErrorInfo
RfcErrorHandlerCGI()
End If
End If
RfcCloseConnection hRFC, RfcErrorInfo
RfcErrorHandlerCGI()
End If
cgi_quit()
End If
'-End-------------------------------------------------------------------
<html>
<head>
<title>Test form for SAP RFC call via CGI</title>
</head>
<body>
<form action="0104_SysInfo_CGI.exe" method="post">
ASHost: <input type="text" name="ASHOST"><br />
SysNr: <input type="text" name="SYSNR"><br />
Client: <input type="text" name="CLIENT"><br />
User: <input type="text" name="USER"><br />
Password: <input type="password" name="PASSWD"><br />
Language:<select name="LANG">
<option>EN</option>
<option>DE</option>
</select>
<br />
<input type="submit" name="sub" value="Ok">
</form>
</body>
</html>
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 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |