Skip to Content
Mobile Infrastructure Login PageList of Mobile DevicesDevice Details

Introduction

This weblog provides a simple implementation that uses SAPRFC , PHPRFC extension and PHP script to view the details of Mobile Devices(Details of Users , Installed Application Details and the Device Profile) attached to the particular MI Server. This blog would be helpful to those non-SAP users(PHP programmers) who are willing to use the simple functionalities provided by SAP MI. The sample scripts implement RFC calls to the function modules MEMGMT_DEVICE_GETLIST(for getting the list of all devices attached to the MI Server) and MEMGMT_DEVICE_GETDETAIL(for getting the details of a particular mobile device).

Prerequisites

1. System must be configured properly to support the PHPRFC(This provides an RFC interface to SAP function modules in PHP).
2. The MI server user , used to login , must have the appropriate authorizations to execute the MI related RFC enabled function modules.

Versions Used

I used the Apache Server 2.0.58 , PHP 5.1.4 and the SAPRFC 1.4.1-5.1.1 as subject installations.

Source Code

This initial.php file is to provide a generic user interface to login into the MI Server.

MI Server Login Details

Server Name
System Number
Client
User
Password

The login page will look like this when you access the page through browser.In this screen you have to enter the MI Server login parameters.

image

This login.php file contains the PHP scripts to display the list of mobile devices attached to the MI Server.I have used a little bit of style sheet and java script codes to format the output while viewing through the browser.

array( “ASHOST”=> $serverName // application server ,”SYSNR”=> $sysNumber // system number ,”CLIENT”=> $sapClient // client ,”USER”=> $sapUser // user ,”PASSWD”=> $userPassword // password ) ,”show_errors”=>false // let class printout errors ,”debug”=>false)) ; // detailed debugging information // Call-Function – For getting the list of installed mobile devices $result=$sap->callFunction(“MEMGMT_DEVICE_GETLIST”, array( array(“TABLE”,”DEVICE_LIST”,array()))); // Call successfull? if ($sap->getStatus() == SAPRFC_OK) { // Yes, print out the LIst of devices ?>

List of All Mobile Devices

Total Number of Mobile Devices   

“; } } } else { // No, print long Version of last Error $sap->printStatus(); // or print your own error-message with the strings received from // $sap->getStatusText() or $sap->getStatusTextLong() } // Logoff/Close saprfc-connection LL/2001-08 $sap->logoff(); ?>

Device ID User Name Device Name Changed Date Changed Time
” , $user[“DEPLID”] , “ “,$user[“USERNAME”],” “,$user[“DEVICE_NAME”],” “, $formDate ,” “,$formTime ,”

You can see the list of Mobile Devices in this screen.From this you will have to click on the particular device id to view its details.

image

The popDeviceDetails.php file contains the script to display the details of the selected mobile device.

array( “ASHOST”=> $_GET[‘serverName’] // application server ,”SYSNR”=> $_GET[‘sysNumber’] // system number ,”CLIENT”=> $_GET[‘sapClient’] // client ,”USER”=> $_GET[‘sapUser’] // user ,”PASSWD”=> $_GET[‘userPassword’] // password ) ,”show_errors”=>false // let class printout errors ,”debug”=>false)) ; // detailed debugging information // Call-Function for getting the details of the selected device. $result=$sap->callFunction(“MEMGMT_DEVICE_GETDETAIL”, array( array(“IMPORT”,”I_DEVICE_ID”,$deviceID), // setting the import parameter array(“TABLE”,”E_USERS”,array()), // users on the client device array(“TABLE”,”E_APPLICATIONS”,array()), // details of applications installed on the device for all users. array(“TABLE”,”E_CLIENTPROFILE”,array()))); // Client device details. // Call successfull? if ($sap->getStatus() == SAPRFC_OK) { // Yes, print out the Userlist ?>

Device Details

Users

“; } ?>

Device ID User Name
“,$deviceID ,” “,$users[“USERNAME”],”
Installed Application Details

“; } ?>

User Name Application Name Version
“,$applications[“USERNAME”] ,” “,$applications[“APPLNAME”],” “,$applications[“VERSION”],”
Device Profile Details

“; } ?>

Attribute Name Attribute Value
“,$clientprofile[“ATTRIBUTE_NAME”] ,” “,$clientprofile[“ATTRIBUTE_VALUE”],”

printStatus(); // or print your own error-message with the strings received from // $sap->getStatusText() or $sap->getStatusTextLong() } // Logoff/Close saprfc-connection LL/2001-08 $sap->logoff(); ?>

In this screen , you can see the , Users , Installed Applications and the device profile parameters such as OS used, Main Memory details, size of the data folder , JVM details , Client Users .etc .

image

Useful links

Summary

Hope you have enjoyed the Mix of PHP and SAP MI.

Author’s Note

You will have to copy these initial.php , login.php and the popDeviceDetails.php files into the htdocs(by default all the php files and html files are stored in this directory) directory of the Apache HTTP Server installation. You can create your own folders to store these php files.But you have to properly change the value of DocumentRoot “(changed document path)” in the httpd.conf file located in the conf directory of Apache home folder.

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