Skip to Content

Awhile back, along the the time that SDN was just starting up I posted and asked and pleaded for help with this topic. The question, “How do I read the MTE Class values using ABAP”?

Well since then I’ve managed to figure it out and I want to share that with you now. Why should I share this tasty little tidbit? Well why not, there are plenty of OpenSource and Commerical tools out there already for this, I’m just going to show you how to do it with ABAP and especially with BSP.

/wp-content/uploads/2004/10/ccms_1_110225.jpg

So what are MTE classes? Well those are the classes associated with RZ20, RZ21, RZ23N. It’s all the stuff to do with the CCMS alerts. If you go into your system and enter the RZ20 transaction you come up with several predefined SAP monitor sets. Now I don’t want to go through the process of how to set up monitor sets and CCMS itself because that is a process in itself. So hopefully you understand what this is before we move further on.

Now the idea is simple here, you have a monitor set and you have “SAPOSCOL” running on your SAP system (see transaction ST06) so therefore your server as well as the system itself is sending data to the CCMS.  If you open one of the monitor sets you’ll see the data and how it looks. Well if you are like me and dealing with more than a couple of systems this transaction is not really the best in the world for visiblity and use. Even if you define your own custom monitor sets.  It just doesn’t work that well with the rest of the things I use on a daily basis.

With that being said I set about the process of trying to read those data values and display them in a different way inside of a report or webpage. Well if you saw the thread that I posted above you can see I’ve been at this awhile, and not just here at SDN trying to find an answer.

I found other programs and “packages” that will do this for me but by this time it was a personal matter between me and CCMS. I was determined to figure this out and accomplish my goal.

I started first by reducing the number of choices and options in a monitor set. I wanted to try and get to a point where it was very, very clear what I needed to read/access for the data. So I created a new Monitor set for my test purposes. I called it “Craigs_Fight”, a bit much but come on I’ve been at this for awhile without help /wp-content/uploads/2004/10/sad_110226.gif. I then defined it like this…
/wp-content/uploads/2004/10/ccms_3_110227.jpg
The result once activated was simple and easy. I figured I had it, I had the basic info for a single MTE class and now how to get that 1% value of the thing?
/wp-content/uploads/2004/10/ccms_2_110228.jpg
So first things first, with your activated Monitor set, click on the CPU_Utilization line and choose the button at the top of the screen “Properties” you’ll need to find the exact name of the MTE Class and value you want to read.
/wp-content/uploads/2004/10/ccms_4_110237.jpg
Then it’s off to some fun with function modules. At which point I will now tell you that I do not know how long these function modules will work because occasionally SAP tends to change things or turn them off.

Ok, we have our value and the first step is of course to find the MTE TID value for the MTE Class/Value. We can do this by using the function module in transaction SE37 “SALR_MTE_GET_TID_BY_NAME” which takes the input value “WA2\\ciwa2_WA2_19\\…\\CPU\\CPU_Utilization” be sure to mark the “Upper/Lower Case” as this is case sensitive. Once we run this, the resulting output is a table:
/wp-content/uploads/2004/10/ccms_5_110238.jpg
Now you need to do the whole CTRL-Y and copy the values from this table, then call the function module “SALR_MTE_GET_TREE” and give the input table the values you just copied. Again watch out for case sensitive! From this function module we get the resulting value of the available MTE sub classes. So find the one you want, in this case CPU_Utilization and copy the values for the TID just like before.

Now call the function module “SALR_MTE_PERF_READ_CUR_VAL” and give the input values (the ones you just copied). From here you get 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 4 of the fields.

  • LASTPERVAL – Actual Last
  • AVG15PVAL – Avg 15 min
  • AVG05PVAL – Avg 5 Min
  • AVG01PVAL – Avg 1 Min

Wow such a lot of work just to get a single value that could have been achieved with another function module called “GET_CPU_ALL”, however like I pointed out we have several systems so with some creative searching image you’ll find the function modules that will return back a table of values for multiple TID’s. Oh by the way if you’d like a good example of “GET_CPU_ALL” you should check out this article by By Siarhei Ulasenka.

Now as most people on here may have noticed already, I am a BSP Freak, I got a t-shirt and everything! So here we go on making a small BSP page to read the data we just struggled to find, and since I’m so happy to finally have the solution I’ll provide the code for reading multiple values.

Page Attributes
style=”border:thin inset;background:lightgrey;background-color:lightgrey;width:400px”>\ CURRENT_VALUE\     TYPE\     ALPERFVAL\     Alert: Performance MT specific value part
CURRENT_VALUES\     TYPE\     ALTIDPACVATBL\     MoniArch: TID plus Perf. Current Values plus RC
wtab\     TYPE\     ALTIDPACVA\     MoniArch: TID plus Perf. Current Values plus RC

Page Layout

\

OnInputProcessing

\

You’ll notice I use a ZCSC_TIDS table, this is basically just a local copy of the TID table.

style=”border:thin inset;background:lightgrey;background-color:lightgrey;width:400px”>\ MTSYSID\     SYSYSID\     CHAR\     8\     0\     Name of SAP R/3 System
MTMCNAME\     ALMCNAME\     CHAR\     40\     0\     Alert: Name of Monitoring Context
MTNUMRANGE\     ALTIDNUMRG\     CHAR\     3\     0\     Alert: monitoring type number range (perm., temp, …)
MTUID\     ALTIDUID\     CHAR\     10\     0\     ALert: Unique Identifier for  Monitoring Types (used in TID)
MTCLASS\     ALTIDMTCL\     CHAR\     3\     0\     Alert: monitoring type class (perf., single msg.,…)
MTINDEX\     ALTIDINDEX\     CHAR\     10\     0\     Alert: internal handle for TID
EXTINDEX\     ALTIDINDEX\     CHAR\     10\     0\     Alert: internal handle for TID

The ZGET_MTE_CURVALUES is a function I created. This function is basically just a copy of the “SALR_MTE_PERF_READ_CUR_VAL_TBL” and remote-enabled since I was calling the function remotely for our tests.

Again there is no telling when SAP will change all of this so use it at your own  risk

So what do we have for resulting output?

/wp-content/uploads/2004/10/ccms_6_110239.jpg

All in all not a bad little exercise I would say. As you play around with it I’m sure you’ll discover several possible uses for this type of functionality.

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.

13 Comments

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

  1. Very interesting, I haven’t had anything to do with MTE classes or RZ20 before, but that little CPU usage example is sure worth a try. Especially because you can have a look at your system without having to login anywhere, just a favorite link in your browser is enough.
    (0) 
  2. Former Member
    There is another function that can be called, but it’s a bit more complicated than this example.
    Z_SDF_CCMS_CON_GET_RZ20_DATA

    You need to make a copy of it and enable remote access with passing values for the INPUT.
    Create your own MTE and link a couple of systems into it.

    It’s much more powerfull and can display multiple systems at once without having to specify each one. And you only have to remote enable one function i.s.o. 3.

    The only problem you will have is that it returns multiple tables with data and you need to search specific for what you want. And the more systems you have the longer it takes.

    But is it ever powerfull!!!

    (0) 
    1. Former Member
      Thanks for the update I don’t recall that FM then again it was many moons ago what version was that available with 640 or prior?
      (0) 
  3. Former Member
    Hi,

    thanks for the article, but I would like to ask you if you have tried to retrieve not only the stats but also the alerts. For the moment I am working with SALR_MON_GET_ALERTS, but this is a generic function which receives the monitor name and set and retrieve all the alerts.

    But I am looking for something more specific, for example to be used after the call to SALR_MTE_GET_TREE, and get the alerts only for one monitoring context. Have you ever tried something like this?

    (0) 
    1. Former Member
      You might think about posting to the forums, I’ve not actually done anything with this code in 6 years and do not have access at the moment to a SolMan system to even take a look anymore.
      (0) 

Leave a Reply