cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting data into SAP tables using SAP.Net connector 3.0

Former Member
0 Kudos

Hello,

I am working on a POC on integrating SharePoint with SAP!! I was successful in fetching data from SAP using NCo 3.0 interfaces, but was facing issues while performing insert operations. Can anyone help on performing insert operation on SAP tables? it will be helpful if someone shares sample code.

Details:

SharePoint - MOSS 2007

SAP ECC 6.0

SAP NCo 3.0

Visual Studio 2008

Regards,

NA

Accepted Solutions (0)

Answers (2)

Answers (2)

jwood_bowdark
Active Participant
0 Kudos

Hi Naren,

I think you can achieve this using an approach like the one outlined below. Thanks.

try

{

RfcDestination rfcDest = RfcDestinationManager.GetDestination(logSys);

IRfcFunction function = rfcDest.Repository.CreateFunction("BAPI_FLBOOKING_GETLIST");

function.SetValue("AIRLINE", "AA");

// Build the flight date range table:

IRfcTable dateRange = function.GetTable("FLIGHT_DATE_RANGE");

dateRange.Insert(); // This adds a new row to the table:

dateRange.CurrentIndex = dateRange.Count - 1;

// Now, simply populate the structure component fields as per usual:

dateRange.SetValue("SIGN", "I");

dateRange.SetValue("OPTION", "EQ");

dateRange.SetValue("LOW", "20110105");

function.Invoke(rfcDest);

...

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

}

Former Member
0 Kudos

Thank you James,

but how can we insert multiple rows in IRfcTable?

here is what i am trying to do. but this is not working.

IRfcTable tblInput = bapiTEST.GetTable("IMPORT");

tblInput.Insert();

//tblInput.CurrentIndex = tblInput.Count - 1;

tblInput.SetValue("NUM1", "000001");

tblInput.SetValue("NUM2", "000002");

tblInput.SetValue("NUM3", "000003");

tblInput.Insert();

tblInput.CurrentIndex = tblInput.Count - 1;

tblInput.SetValue("NUM1", "000004");

tblInput.SetValue("NUM2", "000005");

tblInput.SetValue("NUM3", "000006");

thank you,

Venkat

Former Member
0 Kudos

HI,

RfcDestinationManager.RegisterDestinationConfiguration(new MyBackendConfig());

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

RfcRepository repo = prd.Repository;

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

// set column names and values.

companyBapi1.SetValue("EMPID", 8);

companyBapi1.SetValue("EMPNAME", "harish");

companyBapi1.SetValue("DEPT", "ByD");

companyBapi1.Invoke(prd);

Best Regards,

Harish.Y

Former Member
0 Kudos

Dear Naren,

Did you find the answer?

I am also facing the same issue. Actually i am passing the table parameter to RFC, but it adding empty row in the table.

When i debug the code the rfctable data is there in .Net side, but it is coming to SAP its passing as null value.

If you found the answer for passing table parameter, kindly provide

Regards,

Prabakaran.K

Edited by: krishnaprabakaran on May 12, 2011 9:38 AM