1. REPORT  ZCRON.
  2. *--[ INI 20140523 Macros para medir tiempos de ejecución
  3. DEFINE cron_data.
  4.   types: begin of ty_cron,
  5.             text(40),
  6.             t_ini type i,
  7.             t_fin type i,
  8.             t_dif type i,
  9.          end of ty_cron.
  10.   data: tb_cron_tab type standard table of ty_cron,
  11.         ls_cron_tab type ty_cron,
  12.         lv_cron_tmp type i.
  13.  
  14. END-OF-DEFINITION.
  15.  
  16. DEFINE cron_add.
  17.   get run time field lv_cron_tmp.
  18.   read table tb_cron_tab into ls_cron_tab with key text = &1.
  19.   if sy-subrc ne 0.
  20.     ls_cron_tab-text = &1.
  21.     ls_cron_tab-t_ini = lv_cron_tmp.
  22.     append ls_cron_tab to tb_cron_tab.
  23.   else.
  24.     ls_cron_tab-t_fin = lv_cron_tmp.
  25.     ls_cron_tab-t_dif = ls_cron_tab-t_fin - ls_cron_tab-t_ini.
  26.     modify tb_cron_tab from ls_cron_tab index sy-tabix.
  27.   endif.
  28. END-OF-DEFINITION.
  29. *--[ FIN 20140523 Macros para medir tiempos de ejecución
  30.  
  31. *--[ ONLY FOR EXAMPLE
  32. TABLES: spfli.
  33. cron_data.  "<-- Create de DATA
  34. cron_add 'ALL PROGRAM'.   "<-- START #1 TIMER
  35. cron_add 'SELECT SPFLI'.  "<-- START #2 TIMER
  36. SELECT * FROM spfli. ENDSELECT.
  37. cron_add 'SELECT SPFLI'.  "<-- STOP #2 TIMER
  38. SELECT * FROM spfli. ENDSELECT.
  39. cron_add 'ALL PROGRAM'.   "<-- START #1 TIMER
  40.  
  41. *--[ View the internal table tb_cron_tab for timers