3

I developed an console application to connect to SAP B1 via DI API and notice the line below is too slow to execute. It takes about 1 min to run.

SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();

*I'm using SAPBusinessOneSDK.dll and already registered the dll using regasm.

Can someone help me identify the cause of the problem?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Maykol Rypka
  • 531
  • 6
  • 19
  • Maybe contact SAP? – NotMe Feb 15 '17 at 19:07
  • I opened a question on SAP community network too! – Maykol Rypka Feb 15 '17 at 19:15
  • First thing that comes to mind is a DNS/Network Issue. If you're using the SAP Server name, try to switch to the IP for test purposes. – Overhed Feb 15 '17 at 20:54
  • So, I changed the IP and deactivated IPV6 too. The problem continues. – Maykol Rypka Feb 16 '17 at 18:53
  • Do your connection details match what's in the "C:\Program Files (x86)\SAP\SAP Business One\Conf\b1-local-machine.xml" file? – Daz Feb 16 '17 at 21:31
  • You said that line takes 1 minute. After that does it continue normally or does it error? Which bitness of DI-API have you installed? – Daz Feb 16 '17 at 21:36
  • Hi @Daz! After that continues normally. I alright tested COM thread apartments MTA and STA, but the problem persists. – Maykol Rypka Feb 17 '17 at 11:14
  • We have Sap B1 PL06 installed and the last SDK version. – Maykol Rypka Feb 17 '17 at 11:23
  • And about the connection details, yes. – Maykol Rypka Feb 17 '17 at 12:11
  • The problem is with the COM, exactly on the instance of SAPbobsCOM.Company(). The Company.Connect(); is fast enough. – Maykol Rypka Feb 17 '17 at 12:15
  • When you create the object it actually downloads the latest version stored in SBO_COMMON and puts it in %TEMP%\SM_OBS_DLL\920140 (or SM_OBS_DLL_64). Perhaps an issue with speed of transferring from database server? Might be worth deleting the folder and watching how fast it gets recreated. – Daz Feb 17 '17 at 12:22
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/135964/discussion-between-maykol-rypka-and-daz). – Maykol Rypka Feb 17 '17 at 13:07

1 Answers1

5

Check the %UserProfile%\AppData\Local\SAP\SAP Business One\Log\DIAPI folder. It can contain a lot of files. Deleting them will speed up new connections.

I've never seen the DI-API connect in less then about 6 seconds.

Daz
  • 2,833
  • 2
  • 23
  • 30
  • I checked the folder, but there's just one file. – Maykol Rypka Feb 16 '17 at 18:57
  • 3
    Hi @Daz, So, I've found the solution! I've removed all b1logger files from the folder: *C:\ProgramData\SAP\SAP Business One\Log\SAP Business One\%UserProfile%\DIAPI* and the execution speed was improved. Now, the connection occurs in 7 seconds. – Maykol Rypka Apr 10 '17 at 19:23
  • @MaykolRypka Just when I thought I knew all the many places SAP dumps cryptic log files - but I've never seen these before. Did you have a lot in there? I've got 189 files going back about 7 months, which I think is when I last reinstalled the B1 client. What I haven't been able to find is any useful information in any of those files! – Daz Apr 12 '17 at 07:18
  • 1
    Hi @Daz. We have more than 30K files on that folder. I think it's because we have an console application that connects with SAP via DI every 5 minutes... – Maykol Rypka Apr 12 '17 at 19:01
  • 2
    You can turn the DIAPI logging off by going to `C:\Program Files (x86)\SAP\SAP Business One DI API\Conf\b1LogConfig.xml` and setting `` to `` – Zac Faragher Oct 25 '17 at 04:52
  • Logger settings are documented here: https://help.sap.com/http.svc/rc/011000358700000883202009e/8.82/en-US/HowTo_Logging_Tracing_88.pdf – Daz Oct 12 '18 at 11:53
  • aaaahahahhaha it Amazes me how slow / bad SAP (certainly B1) is... I've been working with it for few years (a little - I'm no SAP expert) but I mean can you imagine the engineers at Google Deep Mind talking about "a 6-7 second process"... and what they'd be achieving in that time. Oh dear... it's upsetting that SAP runs most of the worlds mega corps logistics... will try the above and see if can squeeze it down to 5 seconds HAHAHAHA – MemeDeveloper Mar 17 '21 at 19:23
  • 1
    @memedeveloper I think I would look at Service Layer for a new project. No connection lag with it. Just a whole new set of gotchas to discover. – Daz Mar 17 '21 at 20:12