Split lv_Result At CrLf Into Table lt_Result. "-Write the content of the output buffer. "-Catch output buffer into a variable and clear output buffer. 'Write-Host $rcStruct.x " : " $rcStruct.y'. Lv_PSCodeExec = lv_PSCodeExec & CrLf & '$TestStruct.y = 2'. Lv_PSCodeExec = lv_PSCodeExec & CrLf & '$TestStruct.x = 4'. '$TestStruct = New-Object Methods.TestStruct'. Lv_PSCodeExec = lv_PSCodeExec & CrLf & 'Write-Host $intRc'. Lv_PSCodeExec = lv_PSCodeExec & CrLf & 'Write-Host $fltRc'. Lv_PSCodeExec = lv_PSCodeExec & CrLf & 'Write-Host $strRc'. Lv_PSCodeExec = lv_PSCode & '::TestMethod()'. "-Call the different functions of the library. Lv_PSCode = lv_Code & lcl_PoSh=>ReadInclAsString( 'ZPSINCLUDE' ). Lcl_PoSh=>ReadInclAsString( 'ZCODEINCLUDE' ) & CrLf.
#Where to find nebula 3 .dll code#
"-Read the dotNET language code from include. Lv_PSCodeExec = '$EnvPath = $env:PATH ' &Ĭall Method Of lo_PS 'Execute' Exporting #1 = lv_PSCodeExec.Ĭall Method Of lo_PS 'OutputString' = lv_Result. "-Add path to the libray to environment path. Set Property Of r_oPS 'OutputWidth' = 128. Set Property Of r_oPS 'OutputMode' = i_OutputMode. If sy-subrc = 0 And r_oPS-Handle > 0 And r_oPS-Type = 'OLE2'.Ĭall Method Of r_oPS 'Init' = lv_Result Exporting #1 = 0.Ĭall Method Of r_oPS 'IsPowerShellInstalled' = lv_Result. "-Variables-Ĭreate Object r_oPS 'SAPIEN.ActiveXPoSHV3'. "-Constants-Ĭonstants CrLf(2) Type c Value cl_abap_char_utilities=>cr_lf. Last but not least the ABAP code: "-Begin. NET language class: #-Begin-Īdd-Type -TypeDefinition $MethodDefinitions -Language VisualBasic > $Null Now the PowerShell code from the include ZPSINCLUDE, to load the. These wrapper functions convert the parameter types, e.g. A few of them are declared as private, but they owns a public wrapper function. '-End-Īs you can see there are seven external test methods declarations with different interfaces and different parameter types. Return Marshal.PtrToStructure(ptrStructTest, New TestStruct().GetType) Public Shared Function TestMethod7(X As Integer, Y As Integer) As TestStructĭim ptrStructTest As IntPtr = pTestMethod7(X, Y) Private Declare Function pTestMethod7 Lib "Test.dll" _Īlias "TestMethod7" (X As Integer, Y As Integer) As IntPtr Marshal.StructureToPtr(StructTest, ptrStructTest, True) Public Shared Sub TestMethod6(StructTestAs TestStruct)ĭim ptrStructTest As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(StructTest)) Private Declare Sub pTestMethod6 Lib "Test.dll" _Īlias "TestMethod6" (StructTest As IntPtr) Public Declare Function TestMethod5 Lib "Test.dll" _
Public Declare Function TestMethod4 Lib "Test.dll" _Īlias "TestMethod4" (fltParam1 As Double) As Double Public Shared Function TestMethod3(strParam1 As String, intParam2 As Integer) As Stringĭim retParam As IntPtr = pTestMethod3(ptrParam1, intParam2) Private Declare Function pTestMethod3 Lib "Test.dll" _Īlias "TestMethod3" (strParam1 As IntPtr, intParam2 As Integer) As IntPtr Public Shared Sub TestMethod2(strParam1 As String)ĭim ptrParam1 As IntPtr = Marshal.StringToHGlobalAuto(strParam1) Private Declare Sub pTestMethod2 Lib "Test.dll" _Īlias "TestMethod2" (strParam1 As IntPtr) Public Declare Sub TestMethod Lib "Test.dll" _ The first code is the include ZCODEINCLUDE which contains the interface to the DLL: '-Begin.
On this way it is possible to call a specific function of the DLL from the ABAP code and to work with its results. NET language code stores the interface to the dynamic link library (DLL). NET language code, which is compiled at runtime. Here now an enhancement which combines the knowledge, to show how easy it is to use DLL function calls in ABAP.Īt first a small architecture map about the using components and their interfaces:įrom the ABAP program, which contains a PowerShell script, we call the ActiveX PowerShell library, via the COM interface. NET languages inside ABAP, based on the same method. Two days ago I presented here an enhancement for an easy using of. With this library I use PowerShells possibilities to compile.
#Where to find nebula 3 .dll how to#
Nearly two years ago I presented here a way, how to call DLL functions via SAPIENs COM library ActiveXPosh.dll. It is a COM library which maps the DLL functions to COM calls, which are easy usable inside an ABAP program.
Five years ago I presented here a way how to call DLL functions in ABAP via the DynamicWrapperX library, which is furthermore available here.