cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Access violation at 02271d4a in module observerdll.dll read address

Former Member
0 Kudos

I am using Delphi 5, SAP DI API for SAP 2004.

On a users machine, when we try to connect, we get an error "Access violation at 02271d4a in module observerdll.dll read address 00000000".

Anyone know why they could be getting this error? And what I need to do to fix it?

thanks

Bill

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Some more info..

The client did NOT find observerdll.dll on his machine. He does have the DI Server installed and running (not sure if that has anything to do with it).

They are running SBO 6.70.178, 2004A, SP: 00 PL: 09

Message was edited by: Bill Vanselow

Message was edited by: Bill Vanselow

Former Member
0 Kudos

Hi,

What is the type of your oCompany?

In my machine, observerdll.dll is in C:\temp\SM_OBS_DLL\670185.

Could you try the following code?

uses SAPbobsCOM_TLB;

...

private

oCompany : SAPbobsCOM_TLB.Company;

procedure TForm1.Button1Click(Sender: TObject);

var

lErrCode : Longint;

sErrMsg : WideString;

begin

// **********************************************************

// Connecting to the company

// **********************************************************

oCompany := SAPbobsCOM_TLB.CoCompany.Create;

oCompany.Server := '(local)'; // Name of your SBO server

oCompany.CompanyDB := 'SBODemo_PT'; // Name of the company your using

oCompany.UserNAme := 'manager'; // SAP User

oCompany.PassWord := 'manager'; // SAP Password

oCompany.language := ln_Portuguese ;

oCompany.UseTrusted := False; // This property depends on you Windows,

If oCompany.Connect <> 0 then

begin

oCompany.GetLastError(lErrCode, sErrMsg);

ShowMessage('Unable to connect to SAP Database ' + sErrMsg);

end;

end;

Ribeiro Santos

Former Member
0 Kudos

Only difference in the code, is I use the following code to create the oCompany object ...

uses SAPbobsCOM_TLB;

...

private

oCompany : Company;

...

OleCheck(CoCreateInstance(CLASS_Company, nil, CLSCTX_ALL,

IID_ICompany, oCompany));

On my machine, both ways works fine.

The oCompany object is being created, because I call...

oCompany.GetCompanyList;

And it returns the companys found for the SAP db.

Former Member
0 Kudos

Could you check if your DI is same than user machine?

Or could you try to uninstall and install, in the user machine, the same DI you have installed in your machine?

Ribeiro Santos

Former Member
0 Kudos

I just found out that the user had installed the lastest SAP DI API (PL9), than the version I was installing, and there was a conflict. I had them unregister and remove the older dll's, and it then all worked fine.

Thanks for all your help!

Former Member
0 Kudos

The problem is I have not been able to reproduce the problem on any of the machines in my office, this is only happening on a client machine. They have just the SAP client, and our program that uses the DI API.

I have instructed my client to search for that dll, and try to rename it, and rerun it. Not sure whether this will fix it or not.

Here is some example code I am using, I do not at this time know the exact point where the error is returning from, I assume from the Connect function.

function TtcSAP.Connect: string;

begin

// return empty on success

Result := '';

try

// make sure it was created

if not Assigned(oCompany) then

begin

Result := 'Error creating Company object.';

Exit;

end;

if oCompany.Connected then

oCompany.Disconnect;

// Specify the user name and password

oCompany.UserName := sUserName;

oCompany.Password := sPassword;

oCompany.DbUserName := sDbUserName;

oCompany.DbPassword := sDbPassword;

oCompany.UseTrusted := bUseTrusted;

// misc settins

oCompany.language := ln_English;

// Specify the Company database

oCompany.CompanyDB := sCompanyDB;

// specify the server

oCompany.Server := sServer;

// connect (0 = success)

if oCompany.Connect() <> 0 then

begin

Result := GetLastError;

if Trim(Result) = '' then

Result := 'Connection failed.';

end;

except

on E: Exception do

Result := E.Message;

end;

end;

Former Member
0 Kudos

Hi,

It seems that you haven't initialize an object.

Can you post your code? Or where is the error?

This happens just in one machine, and others works well?

Ribeiro Santos

Message was edited by: Ribeiro Santos