on 01-25-2011 1:24 PM
Hi,
In the connector 2.0 we were passing parameters (vendor# as input) to rfc as ( eg: rfc_name(I_vendor, E_VendorTBL) and able get the results in the output table .
How do we do this using new NCO3.0.
Thanks,
Rajender
static void Main(string[] args)
{
RfcDestinationManager.RegisterDestinationConfiguration(new MyBackendConfig());
RfcDestination prd = RfcDestinationManager.GetDestination("PRD_000");
RfcRepository repo = prd.Repository;
IRfcFunction companyBapi = repo.CreateFunction("BAPI_SALESORDER_GETLIST");
companyBapi.SetValue("CUSTOMER_NUMBER", "246");
The code above shows how to pass parameters such as the vendor number to the BAPI. I've been able to make it work for the example BAPI (BAPI_COMPANY_DETAIL) that is in the SAP .NET Connector 3.0 Overview document on page 9.
I don't know how to pass or catch returned IRfcTable objects though...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the sample code to pass the input values to RFC. Also, as you said, is there any way in NCO 3.0 to convert rfcTable to .Net datatable (like in connector 2.0, we have "ToADOtable", "FromADOtable") so that we can bind the output table directly to gridview.
It seems to be big drawback that, unable to get intellisence.
Here is something I wrote that should get you started...
IRfcTable lrfcTable = bapi.GetTable("TICKETS") ;
DataTable loTable = new DataTable();
//... Create ADO.Net table.
for (int liElement = 0; liElement < lrfcTable.ElementCount; liElement++) {
RfcElementMetadata metadata = lrfcTable.GetElementMetadata(liElement);
loTable.Columns.Add(metadata.Name);
}
//... Transfer rows from lrfcTable to ADO.Net table.
foreach (IRfcStructure row in lrfcTable) {
DataRow ldr = loTable.NewRow();
for (int liElement = 0; liElement < lrfcTable.ElementCount; liElement++) {
RfcElementMetadata metadata = lrfcTable.GetElementMetadata(liElement);
ldr[metadata.Name] = row.GetString(metadata.Name);
}
loTable.Rows.Add(ldr);
}
//... Bind ADO.Net table.
DataGrid1.DataSource = loTable;
DataGrid1.DataBind();
I have implemented an example similar to the above which stores the results of a table in a .net DataTable. I am trying to bind the DataTable to a DataGridView but the DataGridView is simply blank.
DataTable dt = svc.getTableData("crmd_orderadm_h");
bindingSource.DataSource = dt;
dataGridView1.DataSource = bindingSource;
Any ideas on why the DataGridView is empty?
>
> I have implemented an example similar to the above which stores the results of a table in a .net DataTable. I am trying to bind the DataTable to a DataGridView but the DataGridView is simply blank.
>
>
>
DataTable dt = svc.getTableData("crmd_orderadm_h");
>
> bindingSource.DataSource = dt;
> dataGridView1.DataSource = bindingSource;
>
>
> Any ideas on why the DataGridView is empty?
For the benefit of others here, I resolved the problem by examining the properties of the datagridview control. In this case, the datagridview control binding property was being set in the visual studio designer and for some reason was not able to be set at runtime. I removed the binding property in the visual studio property window and the problem was resolved.
Thanks for those who contributed answers to this issue.
Edited by: Mike Powell on Mar 1, 2011 3:30 PM
Have you tried:
dataGridView1.DataSource = dt;
dataGridView1.DataBind();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.