Process Chain Statistics Extractor – 0TCT_IS21

0TCT_IS21  is a “Technical Content” extractor that will retrieve statistics from the Process Chainws execution logs. These logs are stored in the following SAP Tables:

  • RSPCPROCESSLOG
  • RSPCLOGCHAIN

The 0TCT_IS21 extractor is a FM based extractor calling the function module RSDDK_BIW_GET_DATA.

The FM is a ‘multi purpose’ function that is used by several TCT extractors. Based on the Data Source it will call the appropriate data extraction subroutine; the one for 0TCT_IS21 is  “PERFORM get_fact_ds21”.

Analysing the  extractor in my system ( I am working on SAP BW 7.30 -SAPKW73008), I noticed the following errors in the extractor itself and in the Transfer Rules / Update Rules to cube 0TCT_C21:

  • Inconsistent conversion of start / end timestamps to start / end date and times
  • Calculation of the overall duration of the process chain is incorrect
  • Calculation of the number of steps in is incorrect

 

Inconsistent conversion of start / end timestamps to start / end date and times

The PC Log Tables provide start and end timestamps. The transfer rule from Data Source 0TCT_DS21 to Infocube 0TCT_C21 derives the start and end time via abap conversion routines. The proble is that start time is converted to the local time zone while end time is converted to UTC.

Code of the start time routine:

FORM COMPUTE_TCTSTRTTIM
  USING    RECORD_NO LIKE SY-TABIX
           TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
           G_S_MINFO TYPE RSSM_S_MINFO
  CHANGING RESULT TYPE /BI0/OITCTSTRTTIM
           G_T_ERRORLOG TYPE rssm_t_errorlog_int
           RETURNCODE LIKE SY-SUBRC
           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
*$*$ begin of routine - insert your code only below this line        *-*
* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
  DATA: l_start_time TYPE t.

  CONVERT TIME STAMP TRAN_STRUCTURE-starttimestamp TIME ZONE sy-zonlo
          INTO TIME l_start_time.

  RESULT = l_start_time.
* returncode <> 0 means skip this record
  RETURNCODE = 0.
* abort <> 0 means skip whole data package !!!
  ABORT = 0.
*$*$ end of routine - insert your code only before this line         *-*
ENDFORM.

Code of the end time routine:

FORM COMPUTE_TCTENDTIM
  USING    RECORD_NO LIKE SY-TABIX
           TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
           G_S_MINFO TYPE RSSM_S_MINFO
  CHANGING RESULT TYPE /BI0/OITCTENDTIM
           G_T_ERRORLOG TYPE rssm_t_errorlog_int
           RETURNCODE LIKE SY-SUBRC
           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
*$*$ begin of routine - insert your code only below this line        *-*
* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
  DATA: l_end_time TYPE t,
        l_tzone TYPE sy-zonlo.

  l_tzone = 'UTC'.  " This needs to be changed to sy-zonlo.
  CONVERT TIME STAMP TRAN_STRUCTURE-endtimestamp TIME ZONE l_tzone
          INTO TIME l_end_time.

  RESULT = l_end_time.
* returncode <> 0 means skip this record
  RETURNCODE = 0.
* abort <> 0 means skip whole data package !!!
  ABORT = 0.
*$*$ end of routine - insert your code only before this line         *-*
ENDFORM.

The transfer rule routines converts the timestamps in similar ways for Start Time (0TCTSTRTTIM) , End Time (0TCTENDTIM), Start Time as Key Figure (0TCTSTIMEK) and Time (0TIME) and also for the dates 0CALDAY, 0TCTSTRTDAT, 0TCTENDDAT.

So if you want to have consistency between all times and dates, you should check all the routines for the conversions of the following elements and replace ‘UTC’ by sy-zonlo on each of them (7 routines in total).

Calculation of the number of steps in is incorrect

The characteristic 0TCTSTAUIK (“Frequency”) counts the number of occurrences of steps in process chains. For individual records inthe 0TCT_C21 cube it should always be 1. For the record summarizing the PC execution (the one with 0TCTPRCSTYP = “#’), it should be the sum of the steps in the process chain. However the 0TCT_DS21 extractor performs the calculation incorrectly and returns a negative number equal to 1 minus the number of steps.

There could be several ways to correct this (apart from asking SAP to do the correction…) One way is by creating an user exit that recalculates the field in the extractor, or by correcting the value in the start routine of the update rule.

Calculation of the overall duration of the process chain is incorrect

Same as above. Characteristic 0TCTDURATION is incorrect for the record summarizing the whole PC execution.  Same solutions as above.

Leave a Reply