cancel
Showing results for 
Search instead for 
Did you mean: 

RFC调用问题

Former Member
0 Kudos

我想问下我再用RFC调用时候出现问题:

procedure TForm1.Button1Click(Sender: TObject);

var

Connection,Funct : variant;

begin

Connection:=SAPLogoncontrol1.NewConnection;

Connection.user:='likb';

Connection.System:='999';

Connection.Client:='999';

Connection.ApplicationServer:='192.168.0.10';

Connection.SystemNumber:='01';

Connection.Password:='likb147';

Connection.Language:='ZH';

SAPLogonControl1.Enabled:= false;

if Connection.LogOn(0,true) then

begin

SAPFunctions1.Connection:=Connection;

SAPFunctions1.RemoveAll;

Funct:=SAPFunctions1.Add('ZR_ZBOGS');

Funct.exports('P_JS').value:=3;

if not Funct.call then

application.MessageBox('no','no',0)

else

application.MessageBox('yes','yex',0);

end;

end;

当我在用delphi6编译的时候,出现的问题是 从Connection.user:='likb'; 这句开始出现问题.

问题的描述是这样的:

EAccessViolation with message ' access violation at address 0045C4C3 in module ' project1.exe'

read of address 00000000'. process stopped.

而我用delphi7编译的时候,一直执行的是 if not Funct.call then

application.MessageBox('no','no',0)

而不是下面的else 句,我想知道是为什么?

能给个详细的说明吗?

Accepted Solutions (0)

Answers (2)

Answers (2)

YapingGao
Employee
Employee
0 Kudos

难说这个内存错误是什么原因造成的。

可以试一下Logon方法的False参数,就是(Connection.LogOn(0,true)替换成Connection.LogOn(0,false))

这样会弹出RFC library自带的标准对话框来输入连接参数。

看看这样做的结果是怎么样的。

Former Member
0 Kudos

EAccessViolation with message ' access violation at address 0045C4C3 in module ' project1.exe'

read of address 00000000'. process stopped.

这类都是内存访问错误,应该是对象没有能够成功创建。

后面那个就很简单了,说明调用总是不成功嘛,要检查一下Funct的返回值。