Search code examples
functiondelphidelimitersaprfc

Delphi SAP SAPFunctions DELIMITER suddenly ignored?


I have an old Delphi application that uses the SAP ActiveX SAPFunctions

var
TmpSAPFunctions: TSAPFunctions;
...
begin
...
TmpSAPFunctions.RemoveAll;
Funct:=TmpSAPFunctions.Add('RFC_READ_TABLE');
Funct.Exports('QUERY_TABLE').Value:='JEST';
Funct.Exports('DELIMITER').Value:=',';

I then recompiled the application in Delphi 2010, but a strange thing is happening. I no longer get data comma delimited CSV, but instead the data seems to be FWV (fixed width values)

I was just updating other parts of the application, so I am not really that wellknown with SAP programming, but it is my understanding from searching the net that CSV mode (that enables the use of delimiter) should be default?

I don't understand how the change from D6 to 2010 can make any difference when the ActiveX on the target/host system is the same.


Solution

  • I think you are right in your answer. A single character "string" is interpreted as Char, e.g. 'A' is stored as #65. This is stored in the variant. A variant is a variant record, so if the variant is queried for a string, it returns "65", and the SAP routine picks the first character of that.

    So you could do:

    Funct.Exports('DELIMITER').Value:=string(','); 
    

    or

    Funct.Exports('DELIMITER').Value:=','#0; // makes ',' a string.