I try to return "bills" from SAP with Powershell. The connection is working, my function is callable, but the Invoke
method does not:
Ausnahme beim Aufrufen von "Invoke" mit 1 Argument(en): "Callbacks from ABAP are not supported"
In C:\Users\test\Desktop\script.ps1:75 Zeichen:10
+ $myFun.Invoke($destination)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : RfcAbapRuntimeException
Upon investigation they say that SAP .NET connector doesn't support the "invoke" call.
Is there an other function that do the similar? I found a post that is almost 5 years ago in c#, and i cant reproduce that.
my powershell script:
#load .net sap connector
Function Load-NCo {
$CurrentDir = Get-Location
[System.IO.Directory]::SetCurrentDirectory($CurrentDir.Path)
$rc = [Reflection.Assembly]::LoadFile("C:\Program Files\SAP\SAP_DotNetConnector3_Net40_x64\" + "sapnco.dll")
$rc = [Reflection.Assembly]::LoadFile("C:\Program Files\SAP\SAP_DotNetConnector3_Net40_x64\" + "sapnco_utils.dll")
}
Function Get-Destination2 {
#-Verbindungsparamter---------------------------------------------
$cfgParams = New-Object SAP.Middleware.Connector.RfcConfigParameters
$cfgParams.Add("NAME", "SAPconnect")
$cfgParams.Add("ASHOST", "xxx.xx.xxx.xx")
$cfgParams.Add("SYSNR", "25")
$cfgParams.Add("CLIENT", "111")
$cfgParams.Add("USER", "test")
$cfgParams.Add("SYSID ","T30")
$cfgParams.Add("LANG","DE")
$cfgParams.Add("PASSWD", "test")
$destination = [SAP.Middleware.Connector.RfcDestinationManager]::GetDestination($cfgParams)
$rfcRepository = [SAP.Middleware.Connector.RfcDestination]
$rfcRepository = $destination.Repository
$myFun = [SAP.Middleware.Connector.IRfcFunction]
$myFun = $rfcRepository.CreateFunction("Z_GET_ARCHIVE_FILE")
$myFun.setValue("SAP_OBJECT" , "test2020")
$myFun.setValue("OBJECT_ID" , "64562254")
$myFun.setValue("ARCHIV_TAB" , "TOAST02")
$myFun.setValue("ARCHIV_ID" , "I8")
$myFun.setValue("AR_OBJECT" , "ZIMT05")
$myFun.Invoke($destination) // error
$table = $myFun.GetTable("T_URLS")
}