var
SAPrfc,Connection2,funct,table_d:variant;
begin
SAPrfc := CreateOleObject('sap.functions');
Connection2 := sapRfc.Connection;
Connection2.ApplicationServer:=’10.161.1.1’;
Connection2.System := ‘00’;
Connection2.Client :=’802’;
Connection2.User := ‘test’; //User Name
Connection2.Password := ‘test’; //password
Connection2.Language := ‘en’;
if Connection2.LogOn(0,true) = true then
begin
funct := saprfc.Add('ZRFC_WLBG_0001');//Assign RFC Name
funct.exports('ZVKORG'):=’wlb0’;//input parameters
funct.exports('ZAUDAT_F'):=’04/01/2005’;//input parameters
funct.exports('ZAUDAT_T'):=’04/05/2005’;//input parameters
funct.Call; //Call RFC
Table_d:= funct.tables.item('IT_OUT');//output parameters
for i:=1 to Table_d.rows.count do
begin
memo1.lines.add(Table_d.value(i,3)); //抓取返回表中的第3个字段的值
end for