#-Begin-----------------------------------------------------------------
#-Function Get-NCoVersion---------------------------------------------
Function Get-NCoVersion {
#-Loads NCo libraries---------------------------------------------
$rc = [Reflection.Assembly]::LoadFile("C:\NCo\sapnco.dll")
$rc = [Reflection.Assembly]::LoadFile("C:\NCo\sapnco_utils.dll")
#-Gets the version of NCo-----------------------------------------
$Version =
[SAP.Middleware.Connector.SAPConnectorInfo]::get_Version()
$PatchLevel =
[SAP.Middleware.Connector.SAPConnectorInfo]::get_KernelPatchLevel()
$SAPRelease =
[SAP.Middleware.Connector.SAPConnectorInfo]::get_SAPRelease()
#-Shows the result------------------------------------------------
Write-Host "`r`nNCo verion:" $Version
Write-Host "Patch Level:" $PatchLevel
Write-Host "SAP Release:" $SAPRelease
}
#-Main----------------------------------------------------------------
Get-NCoVersion
#-End-------------------------------------------------------------------
#-Begin-----------------------------------------------------------------
#-Function Invoke-SAPFunctionModule-----------------------------------
Function Invoke-SAPFunctionModule {
#-Loads NCo libraries---------------------------------------------
$rc = [Reflection.Assembly]::LoadFile("C:\NCo\sapnco.dll")
$rc = [Reflection.Assembly]::LoadFile("C:\NCo\sapnco_utils.dll")
#-Sets connection parameters--------------------------------------
$cfgParams = New-Object SAP.Middleware.Connector.RfcConfigParameters
$cfgParams.Add("NAME", "TEST")
$cfgParams.Add("ASHOST", "ABAP")
$cfgParams.Add("SYSNR", "00")
$cfgParams.Add("CLIENT", "001")
$cfgParams.Add("USER", "BCUSER")
$cfgParams.Add("PASSWD", "minisap")
#-Destination-----------------------------------------------------
$destination =
[SAP.Middleware.Connector.RfcDestinationManager]::GetDestination($cfgParams)
#-Metadata--------------------------------------------------------
[SAP.Middleware.Connector.IRfcFunction]$rfcFunction =
$destination.Repository.CreateFunction("STFC_CONNECTION")
#-Sets import parameter-------------------------------------------
$rfcFunction.SetValue("REQUTEXT", "Hello World from PowerShell")
#-Calls function module-------------------------------------------
$rfcFunction.Invoke($destination)
#-Shows export parameters-----------------------------------------
Write-Host $rfcFunction.GetValue("ECHOTEXT")
Write-Host $rfcFunction.GetValue("RESPTEXT")
}
#-Main----------------------------------------------------------------
Invoke-SAPFunctionModule
#-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 |
---|---|
8 | |
5 | |
4 | |
4 | |
4 | |
3 | |
2 | |
2 | |
2 | |
2 |