Hardcore Tip: How to Patch UiPath.SAP.BAPI.dll to use it without additional SAP NCo Installation

A month ago I posted here a suggestion to use UiPath BAPI activity without an additional installation of SAP dotNET Connector (NCo), only with SAP GUI for Windows. Today I tried a way to realize this which I want to describe here briefly:

  1. Download UiPath.SAP.BAPI.Activities.2.2.2.nupkg.
  2. Extract UiPath.SAP.BAPI.dll.
  3. Patch hex 03 00 00 00 00 00 2A 00 to 03 00 01 00 00 00 2A 00. This is the version number of sapnco.dll and sapnco_utils.dll in the AssemblyRef table stream of the PE. This hex code appears twice in the file. On this way you change assembly version from 3.0.0.42 to 3.1.0.42, the version number of the SAP NCo, which is delivered with the SAP GUI for Windows.
    image
  4. Write the patched file back to NuGet packaged.
  5. Download ClosedXML.0.95.3.nupkg and DocumentFormat.OpenXml.2.11.3.nupkg.
  6. Install the BAPI activity via Managed Packages.

Now everything is done to use the UiPath.SAP.BAPI.Activity without an additional SAP NCo installation.

Be careful what you do. You are responsibility for yourself.

This confirms the possibility to use BAPI activity even without additional NCo installation, simply by using the SAP GUI for Windows.

3 Likes

@StefanSchnell I did not want even to give a like :heart: on this post :)))))

Amazing post, this remember me on my time learning assembler, debugging the stuff and searching for such Tech-Hacks and ideas for software improvement on MS-DOS.

"You are responsibility for yourself" → Love this disclaimer!!!

1 Like

@LevKushnir

Hello Lev,

I was a bit reluctant to write this post but decided to do so. I know, patching binary files is really not an easy task and that it is something at the borderline. But I thought to myself that this knowledge might be very helpful for some people - as workaround.

You learned good old fashioned MS-DOS Assembler, me too :smiley:

Do you remember the opcode sequence B4 30 CD 21 to get the MS-DOS version number and to patch the following byte sequence so that the program runs on any version?

Best regards
Stefan

I tried this method with UiPath.SAP.BAPI.Activities.2.2.5.nupkg and now it is a little bit different.

  1. Download UiPath.SAP.BAPI.Activities.2.2.5.nupkg.
  2. Open the NuGet package with a ZIP tool and delete the file .signature.p7s.
  3. Extract UiPath.SAP.BAPI.dll.
  4. Patch hex 03 00 00 00 00 00 2A 00 to 03 00 01 00 00 00 2A 00 as described above.
  5. Write the patched file back to NuGet package.
  6. Download ClosedXML.0.87.1.nupkg, DocumentFormat.OpenXML.2.5.0.nupkg, Newtonsoft.json.12.0.3.nupkg and UiPath.Telemetry.Client.1.2.20.nupkg.
  7. Install the BAPI activity via Managed Packages.

Now everything is done to use the UiPath.SAP.BAPI.Activity without an additional SAP NCo installation.

Be careful what you do. You are responsibility for yourself.

3 Likes