cancel
Showing results for 
Search instead for 
Did you mean: 

Access Protected Memory Error in Company.Connect in SAP Business One 8.81

Former Member
0 Kudos

Hi All,

i got an annoying problem in my addon connecting to SAP B1 8.81.

It randomly happens that when i try to connect to company, i got an access violation error.

I'm trying to connect to SAP B1 8.81 PL05.

THis is My Code:

Private Function ConnectToCompany() As Integer

'// Establish the connection to the company database.

Dim iConnect As Integer

Try

iConnect = oCompany.Connect

Return iConnect

Catch ex As AccessViolationException

Dim sBuffer As String = ""

sBuffer = oCompany.GetLastErrorDescription

MsgBox(ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace)

Return -1

End Try

End Function

The GetLastErrorDEscription is empty and the connect returns me 0 (connection OK) but it's not true because just while connecting and assigning return value to my variable, i got the exception and after that the addon results not connected to the company even if the results of the connect seems to be 0 according to the getlasterrordescription that is empty.

I'm using as connection string the development connection string (0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056)

What could be the problem? DI API bug?...DB Installation?

Thanks in advance.

Edited by: Nicola Piccone on May 21, 2011 2:11 PM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

same problem i was facing but i have solved problem .

use below code for connecting oCompany object.

Private Function ConnectToCompany() As Integer

Try

'// Establish the connection to the company database.

oCompany = SBO_Application.Company.GetDICompany

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

End Function

Thanks

Rajkumar Gupta

0 Kudos

Dear Partners,

I have noticed this thread and the problems that you are facing. We have reviewed our Test automation results for PL05 and found no mention of any issues with add-ons in the results.

Our support colleagues have investigated any known issues based on the description in this thread and suggested that the symptoms are pointing towards an installation issue that can be resolved following the steps described in Note Link: [770557|https://b1-support.wdf.sap.corp/sap/support/notes/0000770557]

In case the issue cannot be resolved following the note above, please log a customer message with SAP and we will do our best to resolve it as soon as possible.

Best Regards

Martin Han

Global Development Support Lead I SAP Business One Global IBD

SAP Slovensko s.r.o. I Plynarenska 7/A I 821 09 Bratislava I Slovakia

horst_lang
Member
0 Kudos

Dear Martin,

I have the same problem at one customer installation with SAP B1 8.81.

So I was searching for a solution and found this hint.

But unfortunately the link to Note 770557 does not work on my computer I get the message: Server not found.

So I logged into SMP and searched for SAP Business One Note "770557". But I got the note "770557 - Error -112, Error extracting dll from cab" form year 2005.

Is this the note you meant to solve the problem "Access Protected Memory Error in Company.Connect in SAP Business One 8.81"?

Or is there a mistake in the number of the note?

Thanks for your answer!

Regards

Horst

Former Member
0 Kudos

I thought too in the begging it was a problem of the DI-API, I did reinstall DI, SDK, and the C++ Redistributable packages 2005, 2008 and after that, the problem persisted, after I erase the temp folder they recommend in this thread I had the problem fix.

Thanks every one

BTW: I'm on B1 8.8 PL20

Edited by: Leonardo Pascual on May 27, 2011 8:27 PM

former_member201110
Active Contributor
0 Kudos

Hi Nicola,

Firstly I'd try deleting the SM_OBS_DLL folder in your temp folder to see if that solves the problem. If the error persists then I'd recommend uninstalling and reinstalling the DI API.

I've been using patch 5 for a little while and haven't come across this error (as yet).

Kind Regards,

Owen

Former Member
0 Kudos

Hi Owen,

first of alla thanks for the answer.

Unfortunately i've already done both of the things that you suggested....so i don't really know what could be the problem.

By the way i'm sure that's a problem in SAP installation, because on our 8.81 test system the problems doesn't happen.

I already told to my customer to reinstall SAP and everything related to it, but no luck.

Any other idea??

Thanks

rasmuswulff_jensen
Active Contributor
0 Kudos

We have seen a lot of reason for this error (which bacially means that you are using in code that is not part of the API (if you search for the error on google you will see that it is not SAP SDK Specific))

>Some claim that is the uninstall and reinstall the .Net framework the error goes away

>Some claim going to the %temp% folder and removing the SM_OBS_DLL folder solves the problem

>Some claim you need to reinstall the DI-API

>Some claim that you need to reinstall the client

>Some claim that you need to upgrade to a higher patch-level in order to remove the problem

Former Member
0 Kudos

Hi Rasmus,

thanks for the answer.

Yes i know that the problem is a general problem and not related to the DI API, but it occurs when i do the DI API call company.connect.

I'm pretty sure that is something related to the installation, but i already told to my customer to do almost all the things suggested, but with no luck.

christophe_averous
Active Participant
0 Kudos

Hi,

I have exactly the same problem after upgrading 8.81 pl04 to 8.81 pl05.

What sound strange are the following:

For the program wich connect to the DI (without the UI):

The problem occur with diffrent frequence depending on the computer.

The problem occur more often with the code written in C#.

Closing everything and removing the %temp% doesn't solve the problem everytime (mainly for the C# application).

For the add-on (using both UI and DI):

When you disconnect a company and you reconnect (for example change company) I'm faced with two cases:

- If one of the add-on is mandatory SAP dump, and even if in the task manager there is no more program using the di we have to wait 1 or 2 minutes to reoppen business one

-if there is no mandatory add-on (only automatic) there is no dump but the following appears:

for example B1up send an error message which state that it failed to connect to the DI.

for my add-on, I also have a problem with the menu implementation when I'm reconnect SAP says that the menu already exist (same with paiement engine)

Regards

Christophe