on 03-11-2009 11:40 AM
Well, I'm trying to call an RFC function from Delphi via ActiveX objects..
I have Codegear 2009 installed and it works without any problem..
But on another system with Delphi7 installed when I ran same code it gives "Bad Variant Type" error when assigning SapLogonControl's connection object to SapFunction's connection parameter... Both computers have same SAP installation. And on both systems ActiveX objects imported correctly on Delphi.
Here is the code:
unit logon1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, OleCtrls, StdCtrls, SAPFunctionsOCX_TLB,
Grids, SAPLogonCtrl_TLB;
type
TForm1 = class(TForm)
SAPFunctions1: TSAPFunctions;
Button2: TButton;
Grid: TStringGrid;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
SAPLogonControl1: TSAPLogonControl;
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1 : TForm1 ;
Table, Funct, Connection : VARIANT ;
implementation
{$R *.DFM}
procedure TForm1.Button2Click(Sender: TObject);
begin
Connection := SAPLogoncontrol1.newConnection;
Connection.User := 'testuser';
Connection.System := 'CRD';
Connection.Client := '300';
Connection.ApplicationServer:= '10.1.1.10';
Connection.SystemNumber := '00';
Connection.Password := 'testpass';
Connection.Language := 'EN' ;
if Connection.LogOn(0,true) = true then
(* parameter "true" = SilentLogOn *)
begin
(* assign the existing connection to the *)
(* component SAPFunctions1 *)
SAPFunctions1.Connection := Connection; // It gives error on this line...
Funct := SAPFunctions1.add('ZGIS_TEST_FUNC');
.
.
.
end;
end;
end.
As I said while Codegear 2009 runs this code without any problem, Delphi 7 crashes on that assignment.. Also I tried outside Delphi, and the file compiled with Codegear works on both systems while the file compiled with Delphi 7 again crashes on buth systems...
Is there a problem with Delphi 7? Should I use at least Delphi 8 or something for compiling?
Hi Hakan,
I have got exactly the same problem. Did you manage to solve it?
Regards,
Pat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hakan,
You must use Non-Unicode RFC library for Delphi 7.0.
( Bende Delphi 7.0 kullaniyorum. Ayni hatayi aldim. Unicode library kullanmistim. Kaldirip Non-Unicode olani kullandim. Su an hata yok. RFC cagirabiliyorum. )
Mustafa Yalcin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.