Hi,
I am trying to call inside a script functions that belong to an automation server like Excel or Word. The exact code that runes in Delphi in late binding is like this:
....
ModValue:= VarArrayCreate([0,7], varDouble);
For i:=0 To 7 do begin
ModValue[i]:= 1;
end;
ret:= SapModel.PropFrame.SetModifiers('R1', VarArrayRef(ModValue));
because open array parameters are not supported I created these functions that I wrapped for the script in another unit:
function Create1DArrayDouble(const L,U:Integer):variant;
begin
Result:=VarArrayCreate([L,U], varDouble);
end;
function ArrayRef(obj:variant):IUnknown ;
begin
Result:=VarArrayRef(obj);
end;
and then I write in the script:
ModValue:=Create1DArrayDouble(0,7);
For i:=0 To 7 do begin
ModValue[i]:= 1;
end;
ModValue[0]:=1000;
ModValue[1]:=0;
ModValue[2]:=0;
ret:= SapModel.PropFrame.SetModifiers('R1', ArrayRef(ModValue));
However it complains about data mismatch in the variable passed by ArrayRef(ModValue) and if I used olevariant instead of variant the application just end abruptly
Comments