Introducing SAP MIEx

This article introduces a simple IE extension to startup, shutdown and restart MI. Also a direct access to MI's main page. ( The target SAP MI client version is MI client (Tomcat runtime) for Win32 OSes excluding the WinCEs versions. )


SAP MI client package comes with an executable program named MobileEngine.exe which is responsible for starting and stopping the Java process of the MI client. It also offers a simple window which serves as the GUI of MI client itself. Basically, what this program does is just create a separate process and call on the startup.bat and shutdown.bat scripts located in the installation directory of MI. Its GUI window instance is actually using the WebBrowser ActiveX control in it with the address set to the default URL which is http://localhost:4444. When executed, the program stays in the system tray with the MI icon shown for accessing the popup menus for starting up and shutting down the MI java process as shown on the figure at the right side.

Accessibility Problem

Though this program is very helpful, its location i.e. on the system task bar, is somewhat far from the work area. I have to move my pointer way on top of the MI icon on the system taskbar, right click and select from the popup menu items. Not to mention that in Windows XP, inactive icons will be hidden if this settings is enabled. Thus it will take you some few clicks before you reach and select the menu item.

Memory Consumption

As I had already described, the MobileEngine.exe is a native program which uses the WebBrowser ActiveX control in it. The same OCX component is actually used by the Internet Explorer program.  Thus, besides from the MI client Java process, this program also consumes some part of your system memories. The next figure illustrates the consumption of the MobileEngine.exe as well as the actual MI Java process.

From the same figure, we can see that it consumes more than the MI Java process. Well, I did not have too many data in my MI application thus, the Java process consumption was a little bit smaller this time. Still, looking at the figure, if we are not to use the MobileEngine.exe program, we could spare that memory. However, it will be too inaccessible for the user not to have those start and stop menus; rather he has to locate the installation directory and run the corresponding batch files from there; which is really impractical.

The Alternative

A fast alternative is just to create a shortcut to the startup and shutdown scripts, as well as to the MI main page URL. Personally, this is the easiest and simpliest way. In this article however, I would like to introduce a little more "handsome" alternative for your MobileEngine.exe by putting our MI execution controls on the Internet Explorer's toolbar. I will describe here the steps on how to extend IE's toolbar and to create our scripts that will be called by our added controls. But before moving to the actual discussion, I would like point out why I choose IE here.

First of all, MI Tomcat client requires a web browser to access the MI main page at the URL http://localhost:4444. Since we will not be using the window offered by the MobileEngine.exe, we have to use the available browser in the system. Internet Explorer is available on any Win32 OS thus I chose this browser as our GUI window to the MI main page. Basing to the fact that most of us are using IE, accessing the MI main page on another IE instance does not create another IE process. Rather it only adds up a little 3-4MB of memory consumption to the original process. On the task manager figure above, I was actually accessing 3 locations on my IE including the MI main page.

What I'm trying to say here is that, if your IE is already running and you want to run/access MI client, use the IE instance to access the MI main page and run your MI Java process thru the batch file script. It will save you around 16-18MB of memory.

Extending IE toolbar

Our controls for executing MI client will be in the form of toolbar items and menu items added into our Internet Explorer's GUI as shown in the figures on the right side. We will be adding four buttons for MI Main page access, start, shutdown and restart buttons. Having these buttons in our IE toolbar, it would be very easy for the user to control SAP MI client as they are available on the same UI window with that of the MI main page. For MI client-side application developers like me,  there would be no need to close the MI window everytime the MI client needs to be restarted.

There are so many articles which explains how to extend Internet Explorer (v4 later). You will one that explains it best from its creator - Microsoft's site at MSDN. I won't give the direct links here but I would rather leave it to the reader's initiative to google for it... :)

Tools we need

To do the following activities, we need the following:

  • A text editor for creating our reg and batch script file. Notepad would suffice.
  • An icon editor for creating our toolbar icons. You may use any icon editor of your choice
  • A GUID generator program to create a GUID for our extension
  • Optional: an installer creator for packaging your files.

Preparing the Icons

First let's prepare the icons which will be used for the buttons. For each button, we need at least one icon. If you want to set the hot icon ( i.e. the icon when the mouse pointer hovers on top of the button) to change its appearance, you need another icon.

Creating the Registry Files

First we create a file for our registry entries. To add an extension to the toolbar menus, it should be added to the HKCU\Software\Microsoft\Internet Explorer\Extensions. In case you want the extension for all users registered in your PC, you have to change the HKCU to HKLM. Here's how our entries should look like for the four extensions that we are going to add. (Please check on MSDN on what these entries are.)

  •  HKCU\Software\Microsoft\Internet Explorer\Extensions\<ExtensionGUID>]
    "Default Visible"="<Yes/No>"
    "HotIcon"="<Path to HotIcon>"
    "Icon"="<Path to Icon>"
    "Exec"="<Path to Exec>"

Creating the Batch Scripts

When menu or toolbar item extension is invoked, the corresponding script or executable program specified in the "Exec" name will be called by IE. So, for our extensions, we need 4 scripts to startup, shutdown and restart MI Client, and a script to show the MI home page. We can use MI client's startup/shutdown batch files however, they would require some modification to hide the window from the user. Also a script for our restart and access to MI home page are necessary.

MIEx Installer Script

Rather than creating these extensions manually, I created a simple installer script with the icons as shown in the figure. The MIEx installer creates three batch file scripts for MI client startup/shutdown/restart and one html file to access the MI home page. This script will ask for the MI installation directory and will copy the existing startup and shutdown batch files modifying some parts of it to make the window transparent from the user. I have packed the installer as well as its uninstaller scripts into an SFV file together with the icon files. Please refer to the following blog entry with regards to the download location.

Launching the Installer Script

When you run the MIEx.exe file, you will be asked where to put the installer and icon files. After the archive is extracted, the installer script is automatically executed. If you want to install MIEx later, you can just run the installer script (VBScript) on the installation directory. You must specify a valid MI installation directory when asked.