Skip to Content


My former post
Reinitialize MI client without reinstallation in seconds! targets only the MI Tomcat version. This post gives an additional information on how to reinitialize your MI Core orAWTversion installation. MI Core/AWTis not equipped with any Tomcat libraries and applications running on top of it use AWT libraries for its GUI..   </p>

Target MI Version

This article applies to SAP Mobile Infrastructure client 2.1 and 2.5 Core or AWT runtime on Windows OS.

  NOTE: Due to the Japanese OS and default font that I’m using, the backslash may appear as ¥ (yen mark) .

The MI File Structure

The file structure of MI Core does not differ that much with the MI Tomcat version. Instead of the webapps directory where the Tomcat applications are deployed, MI Core has a wwwroot directory in its root directory. This folder however is NOT the location for the AWT applications; instead this wwwroot folder is the location of the +microITS +application of MI.

Re-initialization Procedures

The re-initialization procedure is quite straight-forward i.e. it is just a revertion of the affected files to its initial state. The operation includes modifying some property files’ key value and removal of directories. Here are the steps that needs to be conducted.

    • Stop the MI framework and stop all the applications opening any MI files.
    • Delete the log , data and sync directories.

Delete all the deployed application jar files inside the *lib directory. Only the +ME.jar+ and+pinstall.jar*+ files should be left, and the system sub-directory  should remain untouched.

Delete the MobileEngine.registry and .syncCounter files inside the settings folder.

    1. Clear the contents of the convids.sys file and delete the covIds sub-directory in the settings folder.

Open the MobileEngine.config file located inside the settings folder using any text  editor and delete the following property keys or set their values to empty. </li>


– MobileEngine.Sync.LastSuccessfulSync

– MobileEngine.Reg.AlreadyInitialized

– MobileEngine.Sync.Deviceid

    1. If you need to remove the user accounts, clear the contents of the file users.dat also.

Automating the Re-initialization Procedures

It would be pretty nice to execute the described re-initialization procedures in just one click. This section shows you how to do it using the Windows shell commands. Again, it would be much easier doing this in Perl or in Visual Basic scripts; the choice however to which tool to use depends on you.


Prior to the procedure’s execution, the framework should not be running and that no files within the installation are used or blocked for modification by external applications.

Removal of Runtime Directories

On the MI root installation directory, folders created during the framework’s runtime should be removed. These folder are +data +, +log +, and +sync + folders. On your MI installation directory, run the following DOS commands.


rem Removing deployed applications

rmdir /s/q log

rmdir /s/q data

rmdir /s/q sync

Take note also that you might need to remove other directories from the installation root folder that were created by the deployed applications during the runtime.

Removal of Deployed Applications

For MI Core version, all deployed applications are in jar format and are saved inside the lib directory, (Personally, I don’t like the idea of putting the deployed archives into the MI  *lib *directory as this mixes the framework and application libraries which makes it hard to distinguish one from the other. For example, what if an application is deployed with the name ME of version 2? It will be deployed to this directory as ME2.jar which makes it hard to distinguish between an application archive and the framework library.

Anyway, to do this step in Windows shell command, here’s the command line. This command deletes all other jar files inside the lib folder except ME.jar and pinstall.jar. </p>


cd lib

    for %i in (dir .) do (if %i==ME.jar (echo preserving %i) else (if %i==pinstall.jar (echo preserving %i) else (del %i)))

cd ..

NOTE: When writing the command in a batch file, take note of the variable %i, it should be rewritten as %%i in a batch file.

Working with Settings Folder

The Registry File++

MI stores all the framework and application/add-on specific information into this registry file. This is created upon the very first execution of the MI framework. To delete this file, run the following command from within the +settings + directory location. You may just as well rename the file into something like +MobileEngine.registry_old + but this would leave unnecessary files into your +settings + folder.


rem Removing MobileEngine.registry

del /s/f/q MobileEngine.registry

The ConversationID Information

The conversation IDs of the framework and of the deployed applications are also stored in the +convids.sys + file and within the +covIds + sub-directory. This information should be reverted as well into its fresh state.

The contents of the +convids.sys + file should be cleaned up. You may use any text editor to delete its contents and overwrite the file. The following commands will delete the +convids.sys + file and then create an empty +convids.sys + file. This would save you some mouse clicks if you are to do it using an editor.


rem Refreshing convids.sys

del /s/f/q convids.sys

type nul>convids.sys

Next, the sub-directory +covIds + is created during the framework’s first execution and is the storage for the +.cid +files which corresponds to every separate and user-shared conversation ids. The following command executed at the +settings + location will remove this sub-folder and its contents.


rmdir /s/q covIds

The Sync Counter

The +.syncCount + file contains the synchronization counter. This file is created during runtime and is updated on every client synchronization with the middleware. The following command will delete this file.


del /s/f/q .syncCount

The Configuration File

MI client stores its configuration information into the +MobileEngine.config +. Some entries having their default values are already contained in this file upon installation. The entries are in their +key + = +value + format. The configuration file can be edited using any text editor. The value of some of the keys should be reverted to its default value or removed from the entries.

In this procedure, all keys will not be reinitialized to their default values but instead we will try to retain the values for Mobile.Sync.* keys to save some energy re-entering the same values over again. Our focus here is on the following keys added by the framework during the runtime. These keys should be removed or set to their empty values.





The following DOS command will set an empty value to these keys. The trick here is to loop into every line entry of the +MobileEngine.config + file and separate it into key and value tokens using the delimiter ‘=’. The for loop will echo the “ +key += +value +” for all keys except for the mentioned keys which will only echo “ +key +=”. The strings printed by the echo command will then be put into the temporary file named as +MobileEngine.TMP +. After the loop, the original +MobileEngine.config + file is deleted and the temporary file to which the new modified values are stored is renamed to +MobileEngine.config +. (The for command should be typed in one line.)


echo off

(FOR /F “usebackq eol=# tokens=1,2* delims==” %i IN (MobileEngine.config) DO (IF %i==MobileEngine.Sync.LastSuccessfulSync (echo %i=) ELSE (IF %i==MobileEngine.Reg.AlreadyInitialized (echo %i=) ELSE (IF %i==MobileEngine.Sync.Deviceid (echo %i=) ELSE (echo %i=%j))))) > MobileEngine.TMP

echo on

del /s/f/q MobileEngine.config

move MobileEngine.TMP MobileEngine.config

User-specific Information (Optional)

The user account information is stored into the +users.dat + file. When you create a new user account in the client, this is where it gets stored. If you do not want to retain the account you created in your existing installation, you have to make this file empty. The following command will delete the file and create an empty +users.dat + file.


rem Refreshing users.dat

del /s/f/q users.dat

type nul> users.dat

Putting them all together

Now, having the ideas on which file and directory to modify or delete, we can merge all the commands into one batch file and save it as +reinit.bat +into your MI root installation folder. Execute this batch file from your MI installation directory.


rem Removing Log, Data, Sync & Work Directories

rmdir /s/q log

rmdir /s/q data

rmdir /s/q sync

rem Deletion of Deployed Applications

rem Delete app jar files other than ME.jar and pinstall.jar

cd lib

    for %%i in (dir .) do (if %%i==ME.jar (echo preserving %%i) else (if %%i==pinstall.jar (echo preserving %%i) else (del %%i)))

cd ..

rem Working with Settings Folder

cd settings

del /s/f/q MobileEngine.registry

del /s/f/q .syncCount

del /s/f/q convids.sys

type nul>convids.sys

del /s/f/q covIds

rmdir /s/q covIds

rem Modifying MobileEngine.config

echo off

(FOR /F “usebackq eol=# tokens=1,2* delims==” %%i IN (MobileEngine.config) DO (IF %%i==MobileEngine.Sync.LastSuccessfulSync (echo %%i=) ELSE (IF %%i==MobileEngine.Reg.AlreadyInitialized (echo %%i=) ELSE (IF %%i==MobileEngine.Sync.Deviceid (echo %%i=) ELSE (echo %%i=%%j))))) > MobileEngine.TMP

echo on

del /s/f/q MobileEngine.config

move MobileEngine.TMP MobileEngine.config

cd ..

echo Finished Reinitialization!

Optional Procedures

If you want to make backups of the target files and directories described in the previous sections, you can create a separate batch file to do this. The following snippet may serve as an example.


rem Creating a BackUp


mkdir %BACKUP_LOC%

xcopy log %BACKUP_LOC%log /e/i/q

xcopy data %BACKUP_LOC%data /e/i/q

xcopy sync %BACKUP_LOC%sync /e/i/q

xcopy lib %BACKUP_LOC%lib /e/i/q

xcopy settingscovIds %BACKUP_LOC%settingscovIds /e/i/q

copy settingsMobileEngine.config %BACKUP_LOC%settingsMobileEngine.config

copy settingsconvids.sys %BACKUP_LOC%settingsconvids.sys

copy settingsMobileEngine.registry %BACKUP_LOC%settingsMobileEngine.registry

copy settings.syncCount %BACKUP_LOC%settings.syncCount


Author’s Note

Patched Framework Version

If your existing MI client has been updated by deploying a patch, the patch info can be verified thru the Info page of the MI. However, if the registry is refreshed, your deployed patch information will be lost. Your info page might not have the patch info displayed, but the client will still be in its patched level state as the libraries were not modified nor changed.

Tool Selection

Again the tool selection depends on your choice of the scripting or native language. The Java code which I presented in my former blog could also be extended for MI Core.

Useful Links

Here are some useful links related to DOS commands and Windows Batch file commands.

[ |]  </p>

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply