09-01-2007 11:21 AM
09-01-2007 11:10 PM
Hi,
You need SAP function modules to retrieve data from MONI. (Monitor Table) This table closely related to transactions STAT, ST03 and other workload anylysis
The following code i found long back in the same forum. May this will help you.
* internal tables for use counter
data: begin of list occurs 5.
include structure sapwlserv.
data: end of list.
data: begin of applicat occurs 0.
include structure sapwlustcx.
data: end of applicat.
data: begin of applica_ occurs 0.
include structure sapwlustcx.
data: end of applica_.
data: begin of applicau occurs 0,
entry_id like sapwlustcx-entry_id,
account like sapwlustcx-account,
count like sapwlustcx-count,
: end of applicau.
data: wa_applicau like applicau.
*&---------------------------------------------------------------------*
*& Form MONI
*&---------------------------------------------------------------------*
form moni.
data: l_host like sapwlserv-hostshort.
m_start = p_usedt.
*** get server
call function 'SAPWL_SERVLIST_GET_LIST'
tables
list = list.
do.
loop at list.
*** loop on server
check not list-instshort is initial.
l_host = list-instshort.
*** get statistics per month and server
perform workload using m_start l_host.
endloop.
add 31 to m_start.
if m_start > sy-datum.
exit.
endif.
enddo.
sort applica_ by entry_id.
sort applicau by entry_id count descending.
endform. " MONI
*&---------------------------------------------------------------------*
*& Form WORKLOAD
*&---------------------------------------------------------------------*
form workload using p_start like sy-datum
p_host like sapwlserv-hostshort.
refresh: applica_.
*** read application statistic from MONI
call function 'SAPWL_WORKLOAD_GET_STATISTIC'
exporting
periodtype = 'M'
hostid = p_host
startdate = p_start
only_application_statistic = 'X'
tables
application_statistic = applica_
exceptions
unknown_periodtype = 1
no_data_found = 2
others = 3.
sort applica_ by entry_id account.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
clear wa_applicau-entry_id.
wa_applicau-entry_id(25) = applica_-entry_id.
wa_applicau-account = applica_-account.
wa_applicau-count = applica_-count.
collect wa_applicau into applicau.
endloop.
sort applicau by entry_id count descending.
applica_-ttype = space.
applica_-account = space.
modify applica_ transporting ttype account
where ttype ne space.
*** collect only enhancements statistic
if p_temp = 'X'.
loop at applica_.
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
else.
loop at applica_ where entry_id(1) ge 'Y'. "#EC PORTABLE
applica_-entry_id+25(48) = space.
collect applica_ into applicat.
endloop.
endif.
endform. " WORKLOAD
a®