RFC Server : Complete Example for Connection from SAP to .NET Application

March 9th, 2009

——————————————————————————-

Downloadable Files :

——————————————————————————-

In some cases, we need a system that SAP maybe a client, and our unSAP application maybe a server. Although SAP is a comprehensive solution center for all enterprise needs, sometimes SAP can not give answer for all of our needs. Think that you need to supply data to outer database that is not your application server’s database. And think that your application server’s database does not give permission to use native SQL commands. What will you do in this case?

Problems maybe more, such as you want to send SMS from SAP, or you want to send fax [I am accepting SAP has an integrated solution for sending fax, but in some firms, respect to SAP application server's version sending fax is not possible]. You can imagine more problems.

In such a case, there maybe several solutions. One of the solutions is that SAP will be client and our outer application will be server. So, when SAP wants to connect our system, this architecture will be used.

Up to now, we have mentioned about connection from VS.NET to SAP. What about connection from SAP to VS.NET? Of course, this is possible :) Not only from SAP to VS.NET, also connection from SAP to Java or to any other develepment tool program that SAP permitted is possible.

In this article, I want to take care attention how to connect our .NET application from SAP synchronously. So, I will do a small application in NET. This application will send mail respect to our parameters. After examining my example, I am sure, you will have lots of idea where to use this solution. Such as, if you run across a problem as I mentioned in first paragraph, you can do my solution.

Let’s look at what we need :
Read more…

ABAP, C#, GMail, RFC, SAP, SAP .NET Connector, Visual Studio

A Comprehensive Example for Connection to SAP with Visual Studio 2008

January 9th, 2009

——————————————————————————-

Required :

  • Visual Studio .NET 2003
  • Visual Studio 2008
  • SAP Application Server [ Any acceptable version for RFC]
  • SAP .NET Connector 1.1 or 2.0 [ 2.0 is suggestion]

——————————————————————————-

As I promised in my previous articles, I will just explain the building stones of connection to SAP using Visual Studio 2008 development tool.

Before reading this article, I suggest my readers should firstly read my two articles. One of this article is for the basic explanation of .NET Connector in Visual Studio .NET 2003. And the second article is for explaining the logic of connection to SAP with Visual Studio 2005 or Visual Studio 2008.

In this article, we will use SAP .NET Connector 2.0 version. SAP .NET Connector is an add on for Visual Studio .NET 2003.  So, we need Visual Studio .NET 2003 development tool. After installing the SAP .NET Connector add on, we will create a ‘class library’ project in Visual Studio .NET 2003. Below, I showed this operation.

sap_conn_vis2008_1
Read more…

C#, SAP, SAP .NET Connector, Visual Studio, Visual Studio 2005, Visual Studio 2008

Sending Synchronous Mail from SAP via Outlook using OLE2 Objects

January 1st, 2009

OLE2 objects are the milestone of COM technologies in SAP. You can connect any other system such as Outlook, Excel, Word, Adobe PDF from SAP with registering these assembly files of these systems.

You can not use OLE2 objects in background. While using some functions deal with OLE2 objects, there should be a connection to GUI.

OLE2 objects are very usefull while creating our localized applications. Such as you need to create an excel file with suppliying SAP data and so you can draw graphics in excel. We can diversify our examples. Think that you have a word template file. Such as a billing word document. You need to supply the required information to this template file. As a result, you can achieve your word document that was feeded with your SAP information as an output.

In our example, we will show a mail document in foreground. We will attach some documents to this mail. I have managed several document management projects in SAP. Documents are scanned and loaded into network and any document can be shown in SAP with the header information of this document. But, there is requirement that this document should be mailed easiliy. So, the fateful operation is adding the reqired documents to outlook mail message.

We will examine how to use the OLE2 objects from the beginning.

Read more…

ABAP, COM, Document Management System, MS Outlook, OLE2, SAP

Free Chart Control for Framework 3.5 from Microsoft

December 20th, 2008

Finally, Microsoft has relased his own chart control. In fact, it is more truth if we say Microsoft bought Dundas firm’s chart controls. But, as a result, Microsoft has a chart control that can integrates his own developer suites. Now, we can say the nightmare of looking for free chart controls or using Excel chart controls via COM has just finished.

I had been using Corlos Aguilar Mare’s chart controls in my ASP.NET projects because of being free. Now, I feel that I have to thank to Carlos. ;)

I will give some basic knowledge about this control in this essay and complete this essay with a sample .

You can download this free chart control from this link. If you want to glance at some samples you can also reach them with this link.

Microsoft presents his chart controls in two different dll groups. The first dll group is for window applications and the second is for the web applications which will be implemented with ASP.NET. Install the first executable file called ‘MSChart.exe’ that I have referenced in first link. Later on installing, you will see 4 dll files under “…\Program Files\Microsoft Chart Controls\Assemblies” path. These dll files are:

  • System.Web.DataVisualization.Design.dll
  • System.Web.DataVisualization.dll
  • System.Windows.Forms.DataVisualization.Design.dll
  • System.Windows.Forms.DataVisualization.dll

As I mentioned just before, there are 2 dlls for windows applications and 2 dlls for web applications and therefore, there are 2 dll groups totally. The dll files that start with ‘System.Web’ is for web group and the dll files start with ‘System.Windows’ is for windows group.

You can drag and drop these dlls into toolbox of Visual Studio or you can install another add on that is developed for Visual Studio 2008. You can download this add on via this link. When you downloaded and installed, you will see a control named ‘Chart’ underlying ‘Data’ tab of toolbox. An important point, it is not possible to use the chart control of add on without installing MSChart.exe file. But, this add on is not absolutely required. If you install MSChart.exe and if you drag and drop the dll files that I have mentioned above into toolbox is an another solution to use chart control.

Before stepping to my sample, let’s look at the examples of ‘WebSamples’ that I have mentioned above.

Read more…

.NET Framework 3.5, C#, Chart Control, Visual Studio, Visual Studio 2008

Google Maps in Visual Studio

December 19th, 2008

I will give information about the usage of Google Maps that is free if not used for trading in Visual Studio development tool. It is not difficult to have your own google maps application. Because, Google made this technology so easy usage and so, you have one work that is only using it. Not only for Visual Studio also Google represents a Google Maps API for Eclipse and Netbeans. We will work the Google Maps API for Visual Studio development tool.

First of all, we need to download Google Maps API for Visual Studio.

You can download this API from this link.

Select free download and download the API. Then create a web application called GoogleMaps as I did in Visual Studio. Create a new tab called ‘Google Maps’ in toolbox of Visual Studio. You will find a dll file called ‘GMaps.dll’ under the file that you have just downloaded. Drag and drop this dll file into ‘Google Maps’ tab. The screen shot of after completing this operation will be as below.

googlemap1

As seen, there are several controls. GMap, GMoonMap, GEarthMap, GMarsMap, vs. Super :) !!!

We will use Gmap control from these several controls. We have just created a web application. Let’s open Default.aspx file and drag and drop GMap control. The last screen shot will be as below.

Read more…

C#, Google Maps, Visual Studio

A Complete Sample : Connection to SAP from Visual Studio .NET 2003 via RFC.

December 18th, 2008

In this article, we will send a material number and get this material’s stock information using Visual Studio .NET 2003 development tool with creating connection to SAP. Before explaining SAP .NET Connector side, let’s look at the required operations in SAP.

It is required that a function has to be defined in SAP to get a database table’s information or to modify a database table if we are using SAP RFC(Remote Function CALL) way. In this function, input and output parameters are defined. Respect to our example, the signature of our function will be as below.

IM_MATNR (Material number) : Input
TABLE_MARD (Stock Information) : Output (Table)
EX_RESULT (Result) : Output

Let’s look at the picture below.

8

As seen in this picture, we named our function as ZGET_MATERIAL_STOCK_INFO. We defined ‘Remote-enabled mode’ for processing type. Selecting the processing type as ‘Remote-enabled mode’ is required information because of we have to inform SAP that we will call this function via RFC.

Let’s look at the import parameters of our function.

9

Respect to these parameters, there is an input parameter called ‘IM_MATNR’. The type of this parameter is MATNR reference type.

One of the important point in above picture, parameters should be called as ‘pass by value’. So, we selected ‘Pass Value’ selection. Otherwise, we will get compile error.

Let’s look at the output parameters.

101

There is only one paramater is returning and it’s name is ‘EX_RESULT’. ‘Pass Value’ should be selected in output paremeters like input parameters.

Let’s look at the tables which will be used in our function. The tables during function call can be both input and output.

Read more…

ABAP, C#, SAP, SAP .NET Connector, Visual Studio

Connection to SAP using Visual Studio 2005 & 2008

December 18th, 2008

SAP has not developed a connector API for Visual Studio 2005 and Visual Studio 2008 yet. I think the reason of not developing a connector API depends on some marketing strategies and the feasibility that can be developed web service that comes with the SAP 6.0, so the technology that can be developed web service in SAP will replace the connector API.

But, there is an important reality that some Visual Studio .NET 2003 projects which were developed before are connecting to SAP with SAP .NET Connector API. There is a ‘technology problem’ that has to be considered by developers if they want to migrate these projects to Visual Studio 2005 or Visual Studio 2008. Respect to this technology problem, SAP firstly suggest to their customers for examining SAP Application Server version whether higher than or equal to 6.0 or not and if higher than or equal to 6.0, developing a web service in SAP Application Server and solving the required connection via this web service. Of course, this is only one solution in all of solutions to this technology problem.

But, what happen if our SAP Application Server version is lower than 6.0 or we don’t want to connect SAP with web service respect to our analyzing decisions although our application server version is higher than or equal to 6.0? SAP has already a solution to this question, too. In fact, this is not an original solution, it is possible that every software specialist can find this solution after thought a while.
Read more…

SAP, SAP .NET Connector, Visual Studio

Starting with thanks..

December 18th, 2008
Comments Off

I thanks to Ramazan Ayyildiz for helps in hosting of my blog site.

This site will be my technical blog site that I will serve to my readers. I am waiting your assessments..

General