Data Supplier for Users Logged On: Report
RSDSUSER
The data supplier RSDSUSER allocates memory for the new performance attribute in which the number of users logged on is reported. It then determines the number of users on its own instance and reports this to the monitoring architecture.
*&--------------------------------------------------------------------*
*& Report RSDSUSER
*
*& *
*&--------------------------------------------------------------------*
*&
*
*&
*
*&--------------------------------------------------------------------*
REPORT RSDSUSER.
* important INCLUDES of CCMS Monitoring Infrastructure
INCLUDE RSALEXTI.
INCLUDE RSALOLDI.
INCLUDE RSALSMI.
INCLUDE RSALSMFI.
*-- global variables of program
--*
DATA: MOTID LIKE ALGLOBTID,
SELF_MONI_TID LIKE ALGLOBTID,
NUSR_TID
LIKE ALGLOBTID,
AN_ERROR_OCCURED(1) VALUE SPACE,
NUMBER_OF_USERS TYPE I.
*-- Start of the main program
--*
START-OF-SELECTION.
* get tid for for self-monitoring message log
perform
create_datasupplier_log_node
changing self_moni_tid.
* self moni send rt 39
("gestartet")
perform
send_selfmon_msc_message
using self_moni_tid 039 sy-repid
space sy-repid.
*
Create Monitor attribute for NUmberOfUsers
PERFORM CREATE_MA_NBRUSER.
* Get number uf users
PERFORM GET_NBRUSER.
* Report number of users
PERFORM REPORT_NBRUSER.
* send ok status for self-monitoring single message,
if no error occure
if an_error_occured is
initial.
* self moni Send RT
101 ("OK")
PERFORM
SEND_SELFMON_MSC_MESSAGE
USING SELF_MONI_TID 101 SY-REPID
SPACE SY-REPID.
endif.
** end of the main program
FORM GET_NBRUSER.
DATA: BEGIN OF USER_TBL OCCURS
100.
INCLUDE
STRUCTURE UINFO.
DATA: END OF USER_TBL.
** Function call to determine the users logged on to
the local instance
CALL FUNCTION 'TH_USER_LIST'
TABLES
LIST = USER_TBL
EXCEPTIONS
OTHERS = 1.
DESCRIBE TABLE USER_TBL LINES
NUMBER_OF_USERS.
ENDFORM.
*-----------------------------------------------*
*-- CREATE_MA_NBRUSER
-----------------------*
*-----------------------------------------------*
FORM CREATE_MA_NBRUSER.
*
First, get the TID of the parent node R3Services\Dialog
* DIALOG_FULLNAME TYPE ALMTNAME_L-ALMTFULLNM VALUE
* '\&SY\&INSTANCE_NAME\R3Services\Dialog',
call function
'SALI_MT_GET_TID_BY_NAME'
exporting
MT_FULL_NAME
= DIALOG_FULLNAME
importing
TID
= MOTID
exceptions
unable_to_expand_name = 1
name_not_found = 2
communication_failure = 3
other_problem =
4
others
= 5.
* If something is wrong, reports the value to the self-monitoring
* single message. Then, exits from the program.
if sy-subrc <> 0.
AN_ERROR_OCCURED =
'X'.
* self moni Send RT
34
PERFORM
SEND_SELFMON_MSC_MESSAGE
USING SELF_MONI_TID 039 DIALOG_FULLNAME SPACE
SY-REPID.
exit.
endif.
*
Main call to create a new performance attribute
CALL FUNCTION
'SALI_PERF_CREATE_ATTACH'
EXPORTING
PARENT_TID
= MOTID
* the parent node
MTE_NAME =
NUSR_NAME
* the name of the new
attribute node ‘R3UsersLoggedIn’
MTE_CLASS
= NUSR_CLASS_NAME
MTE_NUMRANGE
= AL_NR_AUTO
MTE_SECONDS_TIL_COLLECTINGTOOL = 240
* collecting
interval
MTE_SECONDS_UNTIL_SET_INACTIVE = 900
MTE_F1_HELP_TEXT_MSGID =
CCMS_SELFMON_MSGID
MTE_F1_HELP_TEXT_MSGNO =
068
* describing
text
PERF_CUSTOMIZING_GROUP =
NUSR_CLASS_NAME
*
PERF_THRESHOLD_DIRECTION =
AL_THRESHDIR_ABOVE
PERF_THRESHOLD_GREEN_TO_YELLOW = 50
PERF_THRESHOLD_YELLOW_TO_RED
= 70
PERF_THRESHOLD_YELLOW_TO_GREEN = 400
PERF_THRESHOLD_RED_TO_YELLOW
= 600
PERF_UNIT_TO_DISPLAY
= SPACE
*
PERF_DECIMALS
= 0
* thresholds
*
PERF_ALERT_TEXT_MSGID
= 'RT'
PERF_ALERT_TEXT_MSGNO
= 577
* alert text
TOOL_COLLECTING
= 'CCMS_User_Collect'
* data collection
method definition in RZ21
*
TOOL_ONALERT
=
* No auto
reaction method
TOOL_ANALYZE
= 'CCMS_User_Analyse'
* analysis method
definition in RZ21
IMPORTING
NEW_TID
= NUSR_TID
EXCEPTIONS
INVALID_TID
= 1
UNABLE_TO_EXPAND_NAME
= 2
INVALID_PARAMETERS
= 3
COMMUNICATION_FAILURE
= 4
OTHER_PROBLEM
= 5
WRONG_SEGMENT
= 6
INTERNAL_FAILURE_SALS
= 7
OTHERS
= 8.
if sy-subrc <> 0.
AN_ERROR_OCCURED =
'X'.
* self moni Send RT
31
PERFORM
SEND_SELFMON_MSC_MESSAGE
USING SELF_MONI_TID 031 NUSR_NAME SPACE
SY-REPID.
exit.
endif.
ENDFORM.
*&--------------------------------------------------------------------*
*&
Form REPORT_NBRUSER
*&--------------------------------------------------------------------*
*
text
*---------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*---------------------------------------------------------------------*
FORM REPORT_NBRUSER.
DATA: REPORTEDBY(16).
REPORTEDBY = SY-REPID.
*
Main call to report number of users logged in
call function
'SALI_PERF_REPORT_VALUE'
exporting
TOTAL_OF_REPORTED_VALUES =
NUMBER_OF_USERS
*
number_of_reported_values = 1
REPORTEDBY
= REPORTEDBY
changing
TID
= NUSR_TID
exceptions
invalid_tid
= 1
wrong_typeclass
= 2
invalid_parameters = 3
communication_failure = 4
other_problem
= 5
others
= 6.
if sy-subrc <> 0.
* self moni Send RT
33
PERFORM
SEND_SELFMON_MSC_MESSAGE
USING SELF_MONI_TID 033 NUSR_NAME SPACE
SY-REPID.
an_error_occured =
'X'.
endif.
ENDFORM.
" REPORT_NBRUSER
● This example report creates the new attribute and fills it with data. Attribute creation and data retrieval can also be performed separately.
● If a data supplier is to create a new node, the following happens:
...
a. The data supplier determines the TID of the parent node with:
CALL FUNCTION 'SALI_MT_GET_TID_BY_NAME'
b. The data supplier creates a new node with:
CALL FUNCTION 'SALI_PERF_CREATE_ATTACH'
(there are analogous SALI* calls for the other attribute types)
The TID of the parent node is specified when doing so.
c. As of this point, you can report values in this node with:
CALL FUNCTION 'SALI_PERF_REPORT_VALUE'
(there are analogous SALI* calls for the other attribute types)
● The data supplier is started under the user SAPSYS. This means that the authorization restrictions that apply for SAPSYS also apply to the data supplier (for example, no RFC authorization).
● A report acts as the data collection method. You can alternatively use a function module. Function modules have the advantage that an internal table with the structure MT_TOOL_INFO can be passed to them. In addition to information about the node to be called, you can also use this structure to pass parameters that can be specified in the method definition of transaction RZ21 (for example, the data collection method CCMS_GEN_TAB_R contains a range of parameters).

You can also call the function modules SALI_MT_GET_TID_BY_NAME and SALI_PERF_CREATE_ATTACH (or the corresponding call for other attribute types) directly from the coding of your component. In this case, you have created an active data supplier that is not called by the CCMS monitoring infrastructure (and therefore does not appear in the method definitions, or in the assigned methods for the node).
An active data supplier makes sense, for example, if values are only to be reported if certain conditions are fulfilled on the application server (such as the occurrence of an error).

For more information about this example, see the following sections:
● Data Supplier for Users Currently Logged On
● Data Supplier for Users Logged On: Decision Tables
● Data Supplier for Users Logged On: Settings in RZ21
Start
Page Creating
a Data Supplier for the CCMS Alert Monitor
