473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need Code Example to Call a SAP Remote Function from C#

I'm looking for an example of how to call a SAP RFC from within a C#
program. If I have a function called "MyFunction" and it takes 1
input parameter and returns one output parameter (a table) how would
it be coded. I have been able to code the connection and it works so
once the connection is established I need to call the funcation. Here
is the code so far.

using System;
using SAP.Connector;
using SAP.Connector.Rfc;
using SAP.Connector.Internal;

namespace ConsoleApplication2
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
static void Main(string[] args)
{
SAP.Connector.Destination dest = new SAP.Connector.Destination();
dest.AppServerHost = "NAFTATEST01.SAP.INTRA";
dest.Client = 300;
dest.SystemNumber = 0;
dest.Username = "myusername";
dest.Password = "mypassword";
SAP.Connector.SAPConnection connSAP = new
SAP.Connector.SAPConnection(dest);

using(connSAP)
{
try
{
connSAP.Open();
Console.WriteLine("SAP Connection was opened...");
connSAP.Close();
}
catch(SAP.Connector.RfcException rfcEx)
{
Console.WriteLine("SAP Connection was failed...");
Console.WriteLine( rfcEx.Message
+ rfcEx.StackTrace);
Console.WriteLine();
}
}
}

}
}

Sep 13 '07 #1
0 6299

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: cider123 | last post by:
I'm coding a project using the following article as reference: http://www.codeproject.com/csharp/DynamicPluginManager.asp In this type of project, plugins are loaded dynamically into a Plugin...
8
by: Mauricio | last post by:
Hello, Currently we have an ASP.NET 2003 app running, on one function the app calls to a stored procedure to SQLServerONE, that stored procedure creates some TEMP tables with the results of a...
9
by: JD | last post by:
Hi guys What if I need to return two values from a function. What's the best way to do it? Function is to load a text file into memory like so: -----8<----- char *LoadFile(char *infile)
7
by: John | last post by:
Hi I have forgotten how to do this. Got a <form ... > with <input type="button" name="Hit Me" onclick="whatever()"> </form> The output of the Javascript function 'whatever' appears on...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
13
by: Hendrik van Rooyen | last post by:
Hi, I would like to do the following as one atomic operation: 1) Append an item to a list 2) Set a Boolean indicator It would be almost like getting and holding the GIL, to prevent a...
3
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Hi: I'm looking for an example of modifying the registry of a remote system. Thanks much! Charles
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.