Daten an den Funktionsbaustein übergeben

  • Michael
  • Michael's Avatar Topic Author
7 years 9 months ago #90 by Michael
Hallo zusammen,

über den Connect for SAP Explorer kann man an die aufgerufene RFC Function unter 'Tables' und 'INPUT_CONTAINER' Daten übergeben. Wie sieht das ganze in Delphi aus? Mit FCFunction.InParameters und FCFunction.Tables bin ich bis jetzt nicht weitergekommen, ebenso mit den Codebeispielen und der Dokumentation.

Ich danke im Voraus für die Hilfe!

Viele Grüße

Michael

Please Anmelden to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
7 years 9 months ago - 7 years 9 months ago #91 by Serge Volkov
Replied by Serge Volkov on topic Daten an den Funktionsbaustein übergeben
Hello Michael.

Let me switch to English since this topic is in the English Forum area.

To summarize your question:
you need a Delphi example of working with Parameters and Tables of RFC function. Correct?

First of all, we could recommend to look through our Client Demo-s that shows various operations with Parameters and Tables of RFC:
  • "RfcCall": demonstrates filling of parameters/tables in the code for a BAPI RFC function (BAPI_PO_GETDETAIL), the call and the further reading of the received values.
  • "RfcWrapper": demonstrates reading/writing of parameters/tables of a Delphi wrapper for an RFC.
  • "DataTypes": demonstrates work with RFC contains parameters of various data types.

Additionally here's an example showing a call of SAP_WAPI_START_WORKFLOW.
procedure CallRFC;
const
  C_RowCount = 2;
var
  oFunction: TSAPxNWClientFunctionGS;
  oConnection: TSAPxNWClientConnectionGS;
  oTable: TSAPxNWTableGS;
  i: Integer;
begin
  oConnection := TSAPxNWClientConnectionGS.Create;
  try
    oConnection.AliasName := 'YourAliasName';
    oConnection.Active := True;

    oFunction := TSAPxNWClientFunctionGS.Create;
    try
      oFunction.Connection := oConnection;
      oFunction.Name := 'SAP_WAPI_START_WORKFLOW';
      oFunction.Prepared := True;

      oFunction.InParameterByName('DESIRED_START_TIME').AsTime := StrToTime('13:00:00');
      // Optional parameter
      // oFunc.InParameterByName('DESIRED_START_DATE').AsDate := Now;

      oTable := oFunction.TableByName('INPUT_CONTAINER');
      oTable.Active := True;
      for i := 0 to C_RowCount - 1 do
      begin
        oTable.Append;
        try
          oTable.FieldByName('ELEMENT').AsString := IntToStr(i);
          oTable.FieldByName('VALUE').AsString   := 'TestValue';
          oTable.Post;
        except
          oTable.Cancel;
          raise;
        end;
      end;
      oFunction.ExecFunction;
      // ...
    finally
      oFunction.Free;
    end;
  finally
    oConnection.Free;
  end;
end;
Last edit: 7 years 9 months ago by Serge Volkov.

Please Anmelden to join the conversation.

Kontakt

  • gs-soft AG

    Delfterstrasse 10

    5000 Aarau

    Schweiz

    Telefon:
    +41 62 832 20 40
    E-Mail:
    Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!


  • Language