- Produkte
- Connect for SAP
- Forum
- Connect for SAP
- Support
- Connection a DBGRid with a table in a wrapped function
Connection a DBGRid with a table in a wrapped function
- Rémy Schnell
- Topic Author
7 years 5 months ago #113 by Rémy Schnell
Connection a DBGRid with a table in a wrapped function was created 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
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 Anmelden to join the conversation.
- Serge Volkov
7 years 5 months ago #120 by Serge Volkov
Replied by Serge Volkov on topic Connection a DBGRid with a table in a wrapped function
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;
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 Anmelden to join the conversation.
- Serge Volkov
7 years 4 months ago #144 by Serge Volkov
Replied by Serge Volkov on topic Connection a DBGRid with a table in a wrapped function
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.
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 Anmelden to join the conversation.