SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Display percentage of dialog steps <1 sec for two peak ho



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Performance tuning | Производительность
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Nov 17, 2007 6:10 pm    Post subject: Display percentage of dialog steps <1 sec for two peak ho Reply with quote

Display percentage of dialog steps < 1 sec for two peak business hours - report

Code:
 

REPORT ZSSTAT20.

***********************************************************************
*                                                                     *
* This program displays the percentage of dialog steps ran under      *
* 1 second for the two peak business hours (the two contiguous one    *
* hour periods whose sum of dialog steps is the largest for all       *
* such periods of the day.                                            *
* The list displys the data by day between and including the start    *
* and end date specified on the input screen.                         *
* The percentage is an accumulated value for the servers determined   *
* on the selection screen.                                            *
*                                                                     *
***********************************************************************

TABLES: SAPWLACCTP.

PARAMETERS: STARTDAT  LIKE  SAPWLACCTP-STARTDATE DEFAULT SY-DATUM.
PARAMETERS: ENDDATE  LIKE  SAPWLACCTP-STARTDATE DEFAULT SY-DATUM.
SELECT-OPTIONS HOST FOR SAPWLACCTP-HOSTID.

DATA: PERIODTYPE LIKE  SAPWLACCTP-PERIODTYPE VALUE 'D',
      HOSTID     LIKE  SAPWLACCTP-HOSTID,
      DAY(9), NDAY TYPE I, INDX LIKE SY-TABIX.
DATA: BEGIN OF WEEK OCCURS 7,
      DAY(9),
END OF WEEK.
DATA: BEGIN OF TASKTYPE_STATISTIC OCCURS 50.
        INCLUDE STRUCTURE  SAPWLTSKTI.
DATA: END OF TASKTYPE_STATISTIC.
DATA: BEGIN OF TASKTYPE_SUM OCCURS 50,
      TIME LIKE SAPWLTSKTI-TIME,
      COUNT LIKE SAPWLTSKTI-COUNT,
      CSUM LIKE SAPWLTSKTI-COUNT,
      CNT001 LIKE SAPWLRTDIS-CNT001,
      CNT002 LIKE SAPWLRTDIS-CNT001,
      CNT003 LIKE SAPWLRTDIS-CNT001,
      CNT004 LIKE SAPWLRTDIS-CNT001,
      CNT005 LIKE SAPWLRTDIS-CNT001,
      CNT006 LIKE SAPWLRTDIS-CNT001,
      CNT007 LIKE SAPWLRTDIS-CNT001,
      CNT008 LIKE SAPWLRTDIS-CNT001,
      CNT009 LIKE SAPWLRTDIS-CNT001,
END OF TASKTYPE_SUM.

DATA: SUM TYPE P DECIMALS 1, ISUM LIKE SAPWLTSKTI-COUNT,
      KEY1 LIKE TASKTYPE_SUM-TIME, KEY2 LIKE TASKTYPE_SUM-TIME.

* Fill the week table
WEEK-DAY = 'Monday'. APPEND WEEK.
WEEK-DAY = 'Tuesday'. APPEND WEEK.
WEEK-DAY = 'Wednesday'. APPEND WEEK.
WEEK-DAY = 'Thursday'. APPEND WEEK.
WEEK-DAY = 'Friday'. APPEND WEEK.
WEEK-DAY = 'Saturday'. APPEND WEEK.
WEEK-DAY = 'Sunday'. APPEND WEEK.

* Display the selected servers and the list header
SKIP.
WRITE: / 'Accumulated data for servers:'.
LOOP AT HOST.
  WRITE: HOST-LOW.
ENDLOOP.
SKIP 3.
WRITE: /5 'Day-Date' COLOR 2, 28 'Time' COLOR 2,
        38 'Dialogue Steps' COLOR 2, 58 '% of Response <1s' COLOR 2.

* Loop on the days and collect the dialog step/response time data
WHILE ENDDATE >= STARTDAT.
  NDAY = STARTDAT MOD 7.
  IF NDAY > 1.
    NDAY = NDAY - 1.
  ELSE.
    NDAY = NDAY + 6.
  ENDIF.
  READ TABLE WEEK INDEX NDAY.
  CLEAR TASKTYPE_SUM.
  REFRESH TASKTYPE_SUM.
  LOOP AT HOST.
    HOSTID = HOST-LOW.
    PERFORM CALCULATE.
  ENDLOOP.
  SKIP.

* Determine and display the total number of dialog steps per day
  CLEAR ISUM.
  LOOP AT TASKTYPE_SUM.
    ISUM = ISUM + TASKTYPE_SUM-COUNT.
  ENDLOOP.
  WRITE: / STARTDAT, WEEK-DAY,  28 '*Total*',  38 ISUM.

* Delete the long night periods
  LOOP AT TASKTYPE_SUM.
    IF TASKTYPE_SUM-TIME CS '00--06'. DELETE TASKTYPE_SUM. ENDIF.
    IF TASKTYPE_SUM-TIME CS '21--24'. DELETE TASKTYPE_SUM. ENDIF.
  ENDLOOP.
* Find the two periods of the day with the most dialog steps
*  sort tasktype_sum by count descending.
*  loop at tasktype_sum.
*    if sy-tabix > 2. delete tasktype_sum. endif.
*  endloop.
*

* Find the two continuous periods of the day with the most dialog steps
  LOOP AT TASKTYPE_SUM.
    IF SY-TABIX = 1.
      ISUM = TASKTYPE_SUM-COUNT.
      CONTINUE.
    ELSE.
      TASKTYPE_SUM-CSUM = ISUM + TASKTYPE_SUM-COUNT.
      MODIFY TASKTYPE_SUM.
      ISUM = TASKTYPE_SUM-COUNT.
    ENDIF.
  ENDLOOP.
  SORT TASKTYPE_SUM BY CSUM DESCENDING.
  READ TABLE TASKTYPE_SUM INDEX 1.
  KEY1 = TASKTYPE_SUM-TIME.
  SORT TASKTYPE_SUM BY TIME.
  READ TABLE TASKTYPE_SUM WITH KEY TIME = KEY1.
  INDX = SY-TABIX - 1.
  READ TABLE TASKTYPE_SUM INDEX INDX.
  KEY2 = TASKTYPE_SUM-TIME.
  LOOP AT TASKTYPE_SUM.
    IF TASKTYPE_SUM-TIME <> KEY1 AND TASKTYPE_SUM-TIME <> KEY2.
      DELETE TASKTYPE_SUM.
    ENDIF.
  ENDLOOP.

* Display the two periods of the day with the most dialog steps
  LOOP AT TASKTYPE_SUM.
    SUM = TASKTYPE_SUM-CNT001 + TASKTYPE_SUM-CNT002 +
    TASKTYPE_SUM-CNT003 + TASKTYPE_SUM-CNT004 +
    TASKTYPE_SUM-CNT005 + TASKTYPE_SUM-CNT006.
    SUM = SUM * 100.
    SUM = SUM / TASKTYPE_SUM-COUNT.
    IF SUM < 90.
      WRITE: /28 TASKTYPE_SUM-TIME,
      38 TASKTYPE_SUM-COUNT, 62(5) SUM COLOR 3.
    ELSE.
      WRITE: /28 TASKTYPE_SUM-TIME,
      38 TASKTYPE_SUM-COUNT, 62(5) SUM.
    ENDIF.
  ENDLOOP.
  STARTDAT = STARTDAT + 1.
ENDWHILE.

*---------------------------------------------------------------------*
*       FORM CALCULATE                                                *
*---------------------------------------------------------------------*
*       Collect the statistics data                                   *
*---------------------------------------------------------------------*
FORM CALCULATE.
  CLEAR TASKTYPE_STATISTIC.
  REFRESH TASKTYPE_STATISTIC.
  CALL FUNCTION 'SAPWL_WORKLOAD_GET_STATISTIC'
       EXPORTING
            PERIODTYPE         = PERIODTYPE
            HOSTID             = HOSTID
            STARTDATE          = STARTDAT
       TABLES
            TASKTYPE_STATISTIC = TASKTYPE_STATISTIC
       EXCEPTIONS
            NO_DATA_FOUND      = 1.
  LOOP AT TASKTYPE_STATISTIC.
    CLEAR TASKTYPE_SUM.
    IF TASKTYPE_STATISTIC-TASKTYPE = 'DIALOG'.
      MOVE-CORRESPONDING TASKTYPE_STATISTIC TO TASKTYPE_SUM.
      COLLECT TASKTYPE_SUM.
    ENDIF.
  ENDLOOP.
ENDFORM.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Performance tuning | Производительность All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.