Skip to Content
author's profile photo Former Member
Former Member

Is SAPbobsCOM.Company thread-safe?

Hey guys,

I have a question about the SAPbobsCOM.Company multi-threading capabilities. Here it goes…

Does SAPbobsCOM.Company handle simultaneous multiple-thread accesses while executing database operations? Or other operations for that
matter? Is it thread-safe?

Or do I need to create-bind a company to each created thread? Making this way a one-to-one relationship between them?

I’m asking because I don’t like having multiple Company objects created and connected to the same Company, that object is expensive to create and connect.

Any thoughts?

Thanks in advance!


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jul 12, 2012 at 08:49 AM

    Hi Lorenzo,

    I know this is an old discussion, but I will just share my experience.

    I had tried to spawn 2 threads using the same company to create Delivery Drafts object.

    During the process, the SQL Server process would almost always get a deadlock process, which means the whole SAP would hang.

    I would then need to go into the SQL Server to kill the blocking process manually.

    So, in this sense I would say that SAPBobsCom.Company is not thread safe.


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Lorenzo,

      Thanks for sharing your solution.

      I tried also spawning a new thread with a completely new company, but also having problem with the SQL deadlock.

      I ended up creating another executable to run the worker processing. The main addon will then send a shell command with line arguments.

      Finishing the Job, the external executable will send an alert in SBO to the user.

      I need this because the worker process will run a very long process.

      I know it is expensive to have 2/more companies at once, but with current memory size of PCs, this is still workable. And my user can still use the whole SBO and/or the main Addon while my worker is running.


  • author's profile photo Former Member
    Former Member
    Posted on Jul 18, 2012 at 02:16 PM

    Hi Edy,

    Thanks again for the feedback,I have a sample project with the solution if anybody interested. I think, if each thread handles potentials deadlocks as explained in this discussion everything should be fine. I haven't been able to replicate any outstanding issue, although with threading, if I did a mistake, sooner or later it will come to float.

    If interested, email me or reply to this post with your email so I can send you the solution.

    Many thanks,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.