Connection a DBGRid with a table in a wrapped function

  • Rémy Schnell
  • Rémy Schnell's Avatar Topic Author
7 years 4 months ago #113 by Rémy Schnell
Dear Connect for SAP team,

I'm working with the newest Version of Connect for SAP (4.0.5). I have successfully generated the wrapping code for a RFC function and could execute it without problems.
The RFC function has an table named PERIODDATA which I can access from the code without problems.
I now wanted to connect this table with a DBGrid component to list the table content to the user.

The DBGrid component is linket to a TDatasource component where I tried to set the DataSet property this way:
DataSource1.DataSet := FSapFunction.PERIODDATA;

Trying to compile this code I get the following error message:
[dcc32 Fehler] frm_main.pas(109): E2010 Inkompatible Typen: 'TDataSet' und 'TSAPxNWZCM_RFC_PIQPERIODDATATableGS'

When I try to cast the table with TDataSource or TSAPxNWTableGS I get an access violation message.

Do I have an error in my coding or is this issue of connecting a visual database component to a table within a wrapped function not possible?

Thank you and best regards,
Rémy

Please Log in to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
7 years 4 months ago #120 by Serge Volkov
Hello Rémy

To summarize the solution we discussed by email.

Generated RFC Wrappers for tables are derived from TSAPxNWTableGS and not from TDataSet.
So they can not be assigned to the "DataSet" property.

The functionality you need is implemented by the class "TSAPxNWClientCompTableGS".
An example of this component's usage can be found in our tool SAPxNWExplorer (see the unit gsSAPxNWFunctionExecuteFrm, the method TfrmSAPxNWFunctionExecuteGS.InternalExecute)

In short:
// A table of your RFC function is connected to the table component
oRfcTable := TSAPxNWClientCompTableGS.Create(...);
oRfcTable.Func := < an RFC function >;
oRfcTable.TableName := < a table of the linked RFC Function >;

// The table component is connected to the Data Source, which connected to a DbGrid
oDataSource := TDataSource.Create(...);
oDataSource.DataSet := oRfcTable;
oGrid.Datasource := oDataSource;
oRfcTable.Active := True;

Please Log in to join the conversation.

  • Serge Volkov
  • Serge Volkov's Avatar
7 years 3 months ago #144 by Serge Volkov
Also it might helpful as an example:
We have added a new demo "TableParamGrids" in the version 4.0.7.
The Demo shows how to use SAPx components with VCL DB grids for editing and displaying of parameters and tables when calling a function module.

Please Log in to join the conversation.

Contact US

  • gs-soft AG

    Delfterstrasse 10

    CH-5000 Aarau

    Switzerland

    Phone:
    +41 62 832 20 40
    E-Mail:
    This email address is being protected from spambots. You need JavaScript enabled to view it.


  • Language