Adding SAP GUI scripting dll to custom activity

Greetings!

I’m trying to write a custom activity using Visual Studio C# and need to use sapfewse.dll there. While the package builds without any problems, UiPath returns an error, when I try to add a variable to any of the Activities. The library does contain “GuiSession” however. What could be the issue causing this error?

Thank you

@Ilia_Elagin,

Check if you could import the sapfewse dll in your workflow using Imports panel in Studio.

Thanks,
Ashok :slight_smile:

@ashokkarale ,

Thank you for your answer!
The package appears to be imported and it shows up in the Imports panel.
Screenshot 2024-06-07 104832

@Ilia_Elagin,

Ok. What’s the variable datatype you have declared?

Thanks,
Ashok :slight_smile:

@ashokkarale ,
I am also part of Ilias team and try to answer :slight_smile:
in the c# code we have something like this:

sapfewse.GuiSession GuiSession = …

our reference to the libraries in the *.csproj looks like this:

..\libs\sapfewse.dll True ..\libs\saprotwr.net.dll True

@Sergey_Rysev,

Ok, so how you are creating instance of sapfewse.GuiSession and passing it?

@ashokkarale
we are trying to port the old UiPrime library to the the version of UiPath.
we took the code from here: GitHub - uiprimeteam/UiPrimePackage
and we assume the error happens either here: UiPrimePackage/UiPrime.SAP/Activities/_Common.cs at 91def66dfd3b10325a973f9610a2d14211844691 · uiprimeteam/UiPrimePackage · GitHub
or here: UiPrimePackage/UiPrime.SAP/Activities/_GuiSession.cs at 91def66dfd3b10325a973f9610a2d14211844691 · uiprimeteam/UiPrimePackage · GitHub

HI @StefanSchnell

Hope you are doing well. Could I kindly ask your for an advice?

You have a plenty of expertise in this area

Thanks a lot, Lev

HI @Ilia_Elagin

Have you seen this solution?

or this discussion

Best regards, Lev

@Ilia_Elagin
can you check the presence of the sapfewse.ocx at the machine?

possible paths:
C:\Program Files\SAP\FrontEnd\SAPgui\sapfewse.ocx
C:\Program Files (x86)\SAP\FrontEnd\SAPgui\sapfewse.ocx

Hello @ppr ,
Thank you for your answer!
Yes, we have this file on the machine, where we use our custom activity.

Hello @LevKushnir
Thank you for your answer!
I went through both threads, but unfortunately couldn’t find the information that might help with our case. I have the assumption, that the issue might be with the library we are using, sapfewse.dll, being written with an older dotnet version, which is only supported in UiPath legacy projects.

We finally could reach the solution. It was important to set properties “Copy Local” and “Embed Interop Types” of each relevant import to yes and no respectively. It was also necessary to add the following lines for each relevant import inside the <Target Name="AddDlls"/> in *.Packaging Project:
image

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.