Skip to Content

Coming into the whole SAP thing as a system admin and working with all the basic stuff I’ve kind of developed a liking to programming for that as well. I tend to stay away from module stuff, once and awhile I venture over to SSM stuff but basically only because it gives me all my system performance and statistics. So today I’m going to take you through the steps of something very basic and something I fought hard to figure out how to do with BSP.
When I first started with programming for our Basic department we found the perfect way to collect data and read it, however with over 100+ systems the trees in RZ20 were just not very nice to work with. So my goal was to grab the data from RZ20 and display it in a nicer format. Without much success I posted a thread here on SDN about the topic hoping for a response, Reading MTE Classes from RZ20/RZ21  \ , unfortunetly at the time SDN was still rather young and no response came and then it was lost over the ages, ok I mean that more posts came and it was just pushed back and back. After awhile I managed to find a solution to the problem and I posted it here on SDN for others to see in the form of a weblog, BSP/ABAP HowTo: Read MTE Class values. Now with the new PHP forum I thought I would take the opportunity to share how to use PHP to read the data.
Now in an effort to save just giving you the content of the same weblog over again, I ask that everyone read BSP/ABAP HowTo: Read MTE Class values and then we can pick up from where that weblog begins to create the BSP page.
For the creation of our PHP page we are going to need the .php files located under saprfc/sapclasses that comes with SAPRFC and then for simplicity a single PHP page we’ll call sap_cpu.php.
Now provided you have done all the work described in BSP/ABAP HowTo: Read MTE Class values in your WAS system then the rest of this will be quite easy.
Oh and speaking of work you’ll need to make a copy of our FM of choice as SAP did not ship this one “remote enabled”, and since PHP is making a “remote” call we kind of need that. Therefore just make a copy of that function module to your customer namespace then comment out a bit and make sure to mark it “remote enabled” under the properties tab then activate it. Again anytime you do this remember it’s for testing purposes as SAP may change the functionality on you.
The standard function from SAP that you need to copy is SALR_MTE_PERF_READ_CUR_VAL. This FM requires one IMPORT parameter (our TID) and returns the “CURRENT_VALUE”, so you now have the current value of your MTE class for this system. The “CURRENT_VALUE” is a table that is returned and for our purposes we just want to read one of the fields.

  • LASTPERVAL – Actual Last

Oh and I called my copied function Z_MTE_READ_CUR_VAL

So you have that now? Great, now did you find your MTE class, the TID you are going to use?

As they say if you answered yes to both of those questions then you can proceed…

Now one of the great things about SAPRFC is the saprfc_test.php program that comes with it.  Once you start that page and login (remember your codepage) then you can type in the function then do a “Generate PHP” and you’ll get a file with all you need to execute the function with your initial data in place!


Now we’ll clean up the file a little bit and try out our page.



That’s it, basically the PHP is only there to display the data just like our BSP page did. Which is basically the point and the power to the whole thing. SAP together with PHP can and is just as powerful as BSP or Java.

Images used:




Updated: Alexander just gave me a link to a SAP document, bummer I didn’t have it sooner 🙂

Including External System Management Programs in the CCMS Monitoring Architecture this of course all comes from a thread which can be found here.

To report this post you need to login first.


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

  1. That shows one of the advantages that PHP can bring to the SAP-world. Imo having a WebAS is still best for most SAP integrated web solutions, but your weblog shows a very useful application for a scenario where maybe a WebAS is not needed or planned.

    I’m sure you’re already working on tons of other things like this one, hope you are allowed to post a few more of them 🙂

    1. Craig Cmehil
      Since we don’t use PHP at work most of the stuff I’ll be working on is just me playing around and most will be on my MiniWAS at home. This one happened to be with a server from work but the next will be one from home 🙂
  2. Jean Luc BERTRAND

    I try ti use the script you put on SDN but I have a problem finding the TID because of the MTMCNAME”=>”xxxxx_XXX_99″ value. Sap transform this field value in uppercase letters then the FM doesn’t retrieve the right information…

    In SE37, I can check uppercase/lowercase and it works, but with php script… ?

    Had you the same problem ? How can I resolve this uppercase problem with php ?

    Thanks by advance.



  3. Gabor Major

    Hi can we get the full source code of this? I’m learning this kind of solutions. I need an example like this to see how it works, how it looks like. Is it possible we can get it?




Leave a Reply