2011 Dec 16 10:03 AM
Hello,
I would to develop, into MS Visual Studio 2010 (c/ c+), a application that allows establishing a RFC connection to SAP (ECC6) and call a Z program, or call a BAPI from my c/c+ application.
Can you recommend a good documentation, possibly with examples?
If anyone has any sample code, maybe a project in MS VS (c/c++), would be great.
Sincerely,
Serena
2011 Dec 16 11:37 AM
Hi,
Hope the following code will help you.
For establishing connection:
public class MyBackendConfig : IDestinationConfiguration
{
public RfcConfigParameters GetParameters(String destinationName)
{
if ("SE38".Equals(destinationName))
{
RfcConfigParameters parms = new RfcConfigParameters();
parms.Add(RfcConfigParameters.AppServerHost, "192.168.1.14");
parms.Add(RfcConfigParameters.SystemNumber, "02");
parms.Add(RfcConfigParameters.User, "abaper");
parms.Add(RfcConfigParameters.Password, "erpanderp");
parms.Add(RfcConfigParameters.Client, "800");
parms.Add(RfcConfigParameters.Language, "EN");
parms.Add(RfcConfigParameters.PoolSize, "5");
parms.Add(RfcConfigParameters.MaxPoolSize, "10");
parms.Add(RfcConfigParameters.IdleTimeout, "600");
return parms;
}
else return null;
}
public bool ChangeEventsSupported()
{
return false;
}
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
}
Getting tables from BAPI:
private void button1_Click(object sender, EventArgs e)
{
checkedListBox1.Items.Clear();
RfcDestination prd = RfcDestinationManager.GetDestination("SE38");
RfcRepository repo = prd.Repository;
IRfcFunction companyBapi1 = repo.CreateFunction("ZBAPI_PACKAGE_OBJECTLIST");
string package = "EU_" + comboBox1.SelectedItem.ToString();
companyBapi1.SetValue("PACKNAME", package);
companyBapi1.Invoke(prd);
IRfcTable address1 = companyBapi1["TOBJECTS"].GetTable();
if (address1.RowCount != 0)
{
for (int index = 0; index < address1.RowCount; ++index)
{
checkedListBox1.Items.Add(address1[index]["PROGRAM"].GetString());
panel2.Visible = true;
}
}
else
{
MessageBox.Show("No Programs Found");
}
}
Hello,
I would to develop, into MS Visual Studio 2010 (c/ c+), a application that allows establishing a RFC connection to SAP (ECC6) and call a Z program, or call a BAPI from my c/c+ application.
Can you recommend a good documentation, possibly with examples?
If anyone has any sample code, maybe a project in MS VS (c/c++), would be great.
Sincerely,
Serena
2011 Dec 16 10:19 AM
Hi
This may help it is with C# i guess as i was not able to view the video
www.youtube.com/watch?v=8tVUVpbapCY
Browse this link you may get more information
http://help.sap.com/saphelp_nw04/helpdata/EN/51/d5470940fd564b888f4beb9523fa6c/frameset.htm
Thanks & Regards
Jayanth.Y
2011 Dec 16 11:01 AM
Thanks, Jayanth.Y!
I read this documentation, but development must be in C or C++. C # not know and I have little time available for development.
Serenaaa
2011 Dec 16 11:53 AM
Hi serenaaa ;
Which method do you use for connect to SAP from VS .net?
Connector 1
Connector 2
Connector 3
WebService
DLL/OCX
Best regards.
2011 Dec 16 12:42 PM
Thank you all.
I downloaded and installed the SAP.NetConnector 3.0, but honestly, I can not figure out how to create a project in MS Visual Studio 2010 c/c++? How to integrate these two environments? Where to start?
I would love to have an example of VC project. I am familiar with c/c++.
Serena
2011 Dec 16 12:59 PM
2011 Dec 16 11:37 AM
Hi,
Hope the following code will help you.
For establishing connection:
public class MyBackendConfig : IDestinationConfiguration
{
public RfcConfigParameters GetParameters(String destinationName)
{
if ("SE38".Equals(destinationName))
{
RfcConfigParameters parms = new RfcConfigParameters();
parms.Add(RfcConfigParameters.AppServerHost, "192.168.1.14");
parms.Add(RfcConfigParameters.SystemNumber, "02");
parms.Add(RfcConfigParameters.User, "abaper");
parms.Add(RfcConfigParameters.Password, "erpanderp");
parms.Add(RfcConfigParameters.Client, "800");
parms.Add(RfcConfigParameters.Language, "EN");
parms.Add(RfcConfigParameters.PoolSize, "5");
parms.Add(RfcConfigParameters.MaxPoolSize, "10");
parms.Add(RfcConfigParameters.IdleTimeout, "600");
return parms;
}
else return null;
}
public bool ChangeEventsSupported()
{
return false;
}
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
}
Getting tables from BAPI:
private void button1_Click(object sender, EventArgs e)
{
checkedListBox1.Items.Clear();
RfcDestination prd = RfcDestinationManager.GetDestination("SE38");
RfcRepository repo = prd.Repository;
IRfcFunction companyBapi1 = repo.CreateFunction("ZBAPI_PACKAGE_OBJECTLIST");
string package = "EU_" + comboBox1.SelectedItem.ToString();
companyBapi1.SetValue("PACKNAME", package);
companyBapi1.Invoke(prd);
IRfcTable address1 = companyBapi1["TOBJECTS"].GetTable();
if (address1.RowCount != 0)
{
for (int index = 0; index < address1.RowCount; ++index)
{
checkedListBox1.Items.Add(address1[index]["PROGRAM"].GetString());
panel2.Visible = true;
}
}
else
{
MessageBox.Show("No Programs Found");
}
}
2014 Jan 15 6:09 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |