BAPI / RFC with Delphi(系列之三)--TSAPLogonControl使用(无对话框的登录sap的delphi源代码)
来源:互联网 发布:汽车评估软件 编辑:程序博客网 时间:2024/04/25 05:15
1、新建一个Form,并在form上添加下列控件 Component Function SAPLogOnControl1 SAP ActiveX-Component to logon to the system Button1 Button to start the procedure
2、源代码如下
unit s_logon;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, OleCtrls, SAPLogonCtrl_TLB, StdCtrls,Grids ;
type
TForm1 = class(TForm)
SAPLogonControl1: TSAPLogonControl;
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
StaticText1: TStaticText;
Button1: TButton;
procedure SAPLogonControl1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Connection :variant;
implementation
{$R *.DFM}
procedure TForm1.SAPLogonControl1Click(Sender: TObject);
begin
(* define connection and it's parameters *)
Connection := SAPLogoncontrol1.newConnection;
(* In some GUI-versions the username *)
(* must be written in uppercase !!! *)
Connection.User := AnsiUpperCase(Edit1.text);
Connection.System := 'IDS';
Connection.Client := '800';
Connection.ApplicationServer := 'SAPIDES';
Connection.SystemNumber := '00';
Connection.Password := Edit2.text;
Connection.Language := 'DE' ;
SAPLogonControl1.Enabled := false;
if Connection.LogOn(0,true) = true then
(* parameter "true" : SilentLogOn *)
begin
ShowMessage('Logon O.K.');
Button1.Enabled:= true;
end
else
begin
ShowMessage('Error on logon :-(((');
SAPLogonControl1.Enabled:=true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
(* cut connection *)
Connection.LogOff;
ShowMessage('System LogOff...');
SAPLogonControl1.Enabled:=true;
Button1.Enabled :=false;
end;
end.
wdtfuncs SAP data type not supportederror on line:Set i_TABNAME = Func.Exports("TABNAME")
Here is my VB code:
Option ExplicitPublic Functions As SAPFunctionsOCX.SAPFunctionsPrivate LogonControl As SAPLogonCtrl.SAPLogonControlPrivate R3Connection As SAPLogonCtrl.ConnectionPrivate TableFactory As SAPTableFactoryDim Func As SAPFunctionsOCX.FunctionPublic i_TABNAME As SAPFunctionsOCX.ParameterPublic i_FIELD As SAPFunctionsOCX.ParameterPublic i_LANGU As SAPFunctionsOCX.ParameterPublic strLabel As SAPFunctionsOCX.Parameter'Public tENTRIES As SAPTableFactoryCtrl.TablePublic Sub Main() Dim ix As Integer Dim retcd As Boolean Dim SilentLogon As Boolean Set LogonControl = CreateObject("SAP.LogonControl.1") Set Functions = CreateObject("SAP.Functions") Set TableFactory = CreateObject("SAP.TableFactory.1") Set R3Connection = LogonControl.NewConnection R3Connection.client = "000" R3Connection.ApplicationServer = "A1KGNB09" R3Connection.language = "DE" R3Connection.User = "BCUSER" R3Connection.Password = "minisap" R3Connection.System = "A1 SAP 620 09" R3Connection.SystemID = "000" R3Connection.SystemNumber = "00" R3Connection.UseSAPLogonIni = False SilentLogon = False retcd = R3Connection.Logon(0, SilentLogon) If retcd <> True Then MsgBox "Logon failed": Exit Sub Functions.Connection = R3Connection Set Func = Functions.Add("DDIF_FIELDLABEL_GET") Set i_TABNAME = Func.Exports("TABNAME") Set i_FIELD = Func.Exports("FIELDNAME") Set i_LANGU = Func.Exports("LANGU") Set strLabel = Func.Imports("LABEL") i_TABNAME.Value = "USR02" i_FIELD.Value = "BNAME" i_LANGU.Value = "DE" Func.Call MsgBox strLabel' Debug.Print eNUMBER_OF_ENTRIES' For ix = 1 To tENTRIES.RowCount' Debug.Print tENTRIES(ix, 1)' Next R3Connection.LogoffEnd Sub
- BAPI / RFC with Delphi(系列之三)--TSAPLogonControl使用(无对话框的登录sap的delphi源代码)
- BAPI / RFC with Delphi(系列之三)--TSAPLogonControl使用(无对话框的登录sap的delphi源代码)
- BAPI / RFC with Delphi(系列之二)--TSAPLogonControl使用(有对话框的登录sap的delphi源代码)
- BAPI / RFC with Delphi(系列之二)--TSAPLogonControl使用(有对话框的登录sap的delphi源代码)
- BAPI / RFC with Delphi(系列之五)--TSAPFunctions和TSAPLogoncontrol使用(无登录对话框Delphi源代码)
- BAPI / RFC with Delphi(系列之五)--TSAPFunctions和TSAPLogoncontrol使用(无登录对话框Delphi源代码)
- BAPI / RFC with Delphi(系列之六)--TSAPFunctions使用BAPI创建PO(有登录对话框的delphi源代码)
- BAPI / RFC with Delphi(系列之六)--TSAPFunctions使用BAPI创建PO(有登录对话框的delphi源代码)
- BAPI / RFC with Delphi(系列之四)--TSAPFunctions使用(有登录对话框的delphi源代码)
- BAPI / RFC with Delphi(系列之四)--TSAPFunctions使用(有登录对话框的delphi源代码)
- BAPI / RFC with Delphi(系列之七)--TBAPIControl使用BUS1001显示物料(Delphi源代码)
- BAPI / RFC with Delphi(系列之八)--TBAPIControl使用BUS2012建立PO(Delphi源代码)
- BAPI / RFC with Delphi(系列之八)--TBAPIControl使用BUS2012建立PO(Delphi源代码)
- BAPI / RFC with Delphi(系列之七)--TBAPIControl使用BUS1001显示物料(Delphi源代码)
- BAPI / RFC with Delphi(系列之一)--安装部件
- BAPI / RFC with Delphi(系列之一)--安装部件
- Delphi登录功能的源代码
- SAP接口编程-RFC系列09 : 使用BAPI
- JavaScript[对象.属性]集锦
- 位置的移动
- BAPI / RFC with Delphi(系列之二)--TSAPLogonControl使用(有对话框的登录sap的delphi源代码)
- Dr. Codd's 对关系型数据库系统的十二条规则
- 自绘列表控件例子网址
- BAPI / RFC with Delphi(系列之三)--TSAPLogonControl使用(无对话框的登录sap的delphi源代码)
- RUP学习总结
- Ajax 輸入驗證
- 面向对象编程的三大特征
- 集成 Struts、Tiles 和 JavaServer Faces
- AJAX支持的自动填充表单
- PowerDesigner生成列注释和方向工程数据库获得列注释的方法
- 技术网站
- Apache Axis v1.1 命令行工具参考1