So … MIIS newbie comes back after some time spent on MIIS development to share with You latest experience of building connection with different systems.
Today’s topic: Connecting with SAP system.
SAP is very common application (is this application or whole system now) in enterprise environment, and often it is a source of information about employees etc in identity management projects.
With MIIS we don’t have at this moment final version of SAP MA, it is now in Beta 3 stage and I will try to use it in my current project, but it is not a case in every environments (some company are not allowing to use something in beta phase as a solution). What we can do then? Answer is – why not to write our own agent?
I faced this task in last week and it showed up to be very easy from technical point of view – the key terms are Extensible Management Agent and SAP .NET Connector 2.0.
Extensible MA is a programming interface which allows You to build Your own MA implementation to access data from system or which are stored in a format, that doesn’t allow You to use standard MAs delivered whit MIIS 2003. As an example of such implementation I can mention agents which are communicating with DB using OleDB library (any OleDB library) or AD agent which is possible to manage Terminal Services attributes. It is simply implementation of interfaces which are allowing us to produce input file for MIIS to consume, and to provide a way perform operations on the data in connected system. But we have to do build this interface on our own, as we know how to interoperate with data source.
SAP .NET Connector is a tool provided by SAP to let .NET developers to interact with SAP as a data source. What it does is simply allows You to generate proxy .NET classes which are calling BAPI functions at SAP side. It generates proxy classes which are reflecting BAPI function and all data structures and tables which it takes as a parameters or returns back.
So now we have a two components:
- Extensible MA interface which allows us to create interface to interoperate with data source
- method delivered by maker of a software to communicate with data source
For our development environment we need to have VS .NET 2003 and Java machine installed. This is because SAP .NET Connector works only with .NET Framework 1.1 (2.0 in its name means only a version) and we have to use this version to generate proxy classes to BAPI we are wishing to use with our MA.
To generate proxy class you have to register SAP server in server explorer, create new class project and add new SAP Connector Proxy object to your class. Then You have to just drag needed BAPIs to this proxy object, everything else is being done by connector, what You have to do is to compile the class at the end.
This generates proxy class which can be used (by reference) with .NET 1.1 or .NET 2.0 projects. You just need to take care that Your project will also have reference to two assemblies delivered with SAP .NET Connector:
as well as reference to System.Web and System.Web.Servises assemblies.
Using proxies generated with SAP .NET Connector is pretty easy. What we need is to create Destination object and fill its property with data required to make a connection to our SAP system. Then we have to create instance of generated proxy class, assign new connection based on Destination object to it and call it. Simple ?? Take a look at code snippet:
Destination sapDestination = new Destination();
sapDestination.AppServerHost = “SapServer”;
sapDestination.Client = SAPClient;
sapDestination.Language = SAPLanguague;
sapestination.Password = password;
sapDestination.SystemNumber = SAPSystemNumber;
sapDestination.Username = user;
SAPProxyClass mySAPProxy = new SAPProxyClass();
SAPProxyClass.Connection = Connection.GetConnection(sapDestination);
SAPProxyClass.ourBAPICall(params); //Do some work here
And here it is our foundation on which we may try to build our MA to talk with SAP system. Of course the whole work here is to understand what BAPIs functions are doing and how to use them to achieve our goal … but that’s the work for consultants. Of course this works for any .NET project, not only for MA implementation.
MIIS newbie over and out.