cancel
Showing results for 
Search instead for 
Did you mean: 

Problem whith RFC_READ_TABLE SAP.NET connector

Former Member
0 Kudos

this my code

RfcDestinationManager.RegisterDestinationConfiguration(new
                 MyBackendConfig());
            RfcDestination prd = RfcDestinationManager.
               GetDestination("PRD_000");
            RfcRepository repo = prd.Repository;
            
            IRfcFunction myFunction =
                   repo.CreateFunction
                  ("BBP_RFC_READ_TABLE");
            myFunction.SetValue("DELIMITER", " ");
            myFunction.SetValue("NO_DATA", " ");
            myFunction.SetValue("ROWCOUNT", 10);
            myFunction.SetValue("QUERY_TABLE", "ZIPAB_HEADER");
            
            IRfcTable tfields = myFunction.GetTable("FIELDS");
            //IRfcTable toptions = myFunction.GetTable("OPTIONS");
            tfields.Append();
            tfields.SetValue("FIELDNAME", "SCENARIOS");
            tfields.SetValue("OFFSET", 3);
            tfields.SetValue("LENGTH", 2);
            tfields.SetValue("TYPE", "C");
            tfields.SetValue("FIELDTEXT", "scénario de gestion");
            //tfields.Append();
            //tfields.SetValue("FIELDNAME", "REFERENCE");
            //tfields.SetValue("OFFSET", 0);
            //tfields.SetValue("LENGTH", 10);
            //tfields.SetValue("TYPE", "CHAR");
            //tfields.SetValue("FIELDTEXT", "REFERENCE");
            //tfields.Append();
            //tfields.SetValue("FIELDNAME", "TICKET_PESAGE");
            //tfields.SetValue("OFFSET", 0);
            //tfields.SetValue("LENGTH", 20);
            //tfields.SetValue("TYPE", "CHAR");
            //tfields.SetValue("FIELDTEXT", "TICKET_PESAGE");
            
            IRfcTable tdata = myFunction.GetTable("DATA");
            

            MessageBox.Show(tdata.RowCount.ToString());

the probleme is that my tdata has no data

tdata.RowCount.ToString() = 0

i know that there is some thing wrong in my code but ...

thanx

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

By using this code we can get the emp details based upon empid

RfcDestinationManager.RegisterDestinationConfiguration(new MyBackendConfig());

RfcDestination prd = RfcDestinationManager.GetDestination("SE37");

RfcRepository repo = prd.Repository;

/// ZBAPI_EMP_RECORDS is the BAPI name

IRfcFunction companyBapi1 = repo.CreateFunction("ZBAPI_EMP_RECORDS");

//// EMPID is the column name

companyBapi1.SetValue("EMPID", 5);

/// EMPTAB is the output table

IRfcTable tbl = companyBapi1["EMPTAB"].GetTable();

companyBapi1.Invoke(prd);

// if u want to diplays the total no of rows in a particular table.

int i = tbl.Count;

MessageBox.Show(i.ToString());

// I think u forgot the invoke method for rfcfunction.

NOTE: If u r facing any problem with SAP.Net connector please let me know. By using this connector i was sucessfully run my application.

Best Regards,

Harish.Y

Former Member
0 Kudos

thanx for your reply

yes i invoke my function but i get an error message about

RfcAbapException, i don't know how to manage this Exception

Former Member
0 Kudos

hi skolov,

Please give the exact requirement. like if u want read the data from sap database or if u want insert data into sap database.

as well as please give exception description.

Best Regards,

Harish.Y

Former Member
0 Kudos

*My probleme is resolved *

i was afecting an incorrect fields properties to the function RFC_READ_TABLE

thanx for reply

Former Member
0 Kudos

Hi Harish Y,

I want to extract particular column in a table from sap system in datagrid view of .net... I have taken the Field name succesfully, but don't know code to extract the values from particular column.