W Pub: ABAP Prog Propios DUMPS

  1. REPORT Znadar_dumps message-id sn no standard page heading
  2.                                line-size 190.
  3.  
  4. select-options: fecha for sy-datum.
  5. select-options: users for sy-uname.
  6. parameters: hoy as checkbox default ' ',
  7.             ayer as checkbox default ' '.
  8.  
  9. data: begin of snap_h occurs 0,
  10.         datum like snap_beg-datum,
  11.         uzeit like snap_beg-uzeit,
  12.         ahost like snap_beg-ahost,
  13.         uname like snap_beg-uname,
  14.         mandt like snap_beg-mandt,
  15.         modno like snap_beg-modno,
  16.         flist like snap_beg-flist,
  17.       end of snap_h.
  18.  
  19. tables: snap,
  20.         snap_beg,
  21.         snapt,
  22.         t100.
  23.  
  24. tables: tdct, tfdir, funct, trdir.
  25.  
  26. types: begin of t_msg,
  27.          id       like sy-msgid,
  28.          no       like sy-msgno,
  29.          v1       like sy-msgv1,
  30.          v2       like sy-msgv2,
  31.          v3       like sy-msgv3,
  32.          v4       like sy-msgv4,
  33.        end   of t_msg.
  34.  
  35. *----------- Field Table FT--------------------------------------------*
  36. *                                                                      *
  37. * FT is filled in BUILT_FT. It contains the SNAP strings, one in each  *
  38. * line. Continuation is indicated by Id = '>>'.                        *
  39. *                                                                      *
  40. *----------------------------------------------------------------------*
  41.  
  42. data: begin of ft occurs 1000,
  43.          id(2), len type i, value(256),
  44.       end of ft.
  45.  
  46. *----------- RS380: Screen fields--------------------------------------*
  47. data: cerrid like snapt-errid.
  48. data: clinno type i.
  49. data: cinclu like sy-repid.
  50. data: tmp_subpool.
  51.  
  52. data: begin of rs380,
  53.  
  54.                  datum like snap-datum,
  55.                  uzeit like snap-uzeit,
  56.                  ahost like snap-ahost,
  57.                  uname like snap-uname,
  58.                  mandt like snap-mandt,
  59.                  modno like snap-modno,
  60.  
  61.                  button_today value 'X',
  62.                  button_yesterday,
  63.                  button_total,
  64.                  button_keep,
  65.                  push_500_list,
  66.                  push_500_sele,
  67.  
  68.                  dumps_today     type i,
  69.                  dumps_yesterday type i,
  70.                  dumps_total     type i,
  71.                  dumps_hold      type i,
  72.                  snap_used_k     type i,
  73.                  snap_free_k     type i,
  74.                  snap_reorg_days type i,
  75.  
  76.        end of rs380.
  77. *-------------------Status variables -----------------------------------
  78.  
  79. data: begin of ok, code like sy-ucomm, end of ok.
  80. data: fc like ok-code.
  81.  
  82. data: init.        " INIT = 'X' iff snapshot already imported
  83. data: print_active.
  84. data: rabax_active.
  85.  
  86.  
  87.  
  88. *-------------------Shared variables / tables---------------------------
  89. data: snap_error(60).
  90. data: continuation(120).
  91.  
  92. data: begin of text_in occurs 400,
  93.                 line(72),
  94.       end of text_in.
  95.  
  96.  
  97. data: begin of text_out occurs 400,
  98.         line(79),
  99.       end of text_out.
  100.  
  101. * List index
  102.  
  103. data: begin of list_index occurs 100,
  104.          text(80), linno type i,
  105.       end of list_index.
  106.  
  107. * Structure of ENV (Environment), SNAP Id EN
  108.  
  109. data: begin of env,
  110.       saprl(6),                        "SAP-Release
  111.       opsys(16),                       "Operating System
  112.       mtype(16),                       "Maschinentyp (Workprozess)
  113.       whost(20),                       "Hostname     (Workprozess)
  114.       dbtyp(20),                       "Datenbanktyp (Oracle, ...)
  115.       dbnam(20),                       "Datenbankname
  116.       dhost(20),                       "Datenbankhostname
  117.       dbown(20),                       "Datenbankowner
  118.       codep(4),                        "Systemcodepage (zur Zeit leer)
  119.       oprel(20),                       "Betriebssystem-Release
  120.       ctype(20),                       "character type (LC_CTYPE)
  121.       compi(30),                       "Compile time
  122.       end   of env.
  123.  
  124. * Structure of SNAP_ID: US (User Data)
  125.  
  126. data: begin of usr,
  127.       mandt(3),                        "SAP-Mandant
  128.       uname(12),                       "Benutzername
  129.       spras(1),                        "Anmeldesprache
  130.       codep(4),                        "Benutzercodepage (zur Zeit leer)
  131.       end   of usr.
  132.  
  133. * Structure of statusinfo
  134. data : begin of statusinfo,
  135.          state(1),
  136.          gen(1),
  137.          btci(1),
  138.          memo(1),
  139.          defect(1),
  140.          btcidt(1),
  141.          warning(1),
  142.        end of statusinfo.
  143.  
  144. *-------------------Ranges (Snaplist) ----------------------------------
  145.  
  146. ranges:
  147.        s_datum for snap-datum,
  148.        s_uzeit for snap-uzeit,
  149.        s_ahost for snap-ahost,
  150.        s_uname for snap-uname,
  151.        s_mandt for snap-mandt,
  152.        s_xhold for snap-xhold,
  153.        s_errid for snapt-errid.
  154.  
  155. data: s_activated(1).
  156. data: loaded_program like sy-repid.
  157.  
  158. * Aufrufstack extrahieren fr nachfolgende Programmgenerierung
  159. data: begin of stack occurs 0,
  160.         prog like sy-repid,
  161.       end of stack.
  162.  
  163. * Messagevariable bei GENERATE REPORT
  164.   data mess(100).
  165.  
  166. tables: usr21, adrp.
  167. DATA: BEGIN OF dnis ocCURS 0,
  168.         DNI(10),                         "Slo pueden tener 3 posiciones
  169.         NOM(40),                         "Slo pueden tener 3 posiciones
  170.       END OF dnis.
  171. data: bi_tab like bdcdata occurs 0 with header line,
  172.       bi_err like BDCMSGCOLL occurs 0 with header line,
  173.       bi_mod(1) value 'E'.
  174.  
  175. initialization.
  176.   fecha-sign = 'I'.
  177.   fecha-option = 'BT'.
  178.   fecha-high = sy-datum.
  179.   append fecha.
  180.    SELECT * FROM USR21.
  181.       SELECT SINGLE * FROM ADRP WHERE PERSNUMBER  = USR21-PERSNUMBER.
  182.       dnis-DNI = USR21-BNAME.
  183.       CONCATENATE ADRP-NAME_FIRST ADRP-NAME_LAST INTO dnis-NOM
  184.                                                  SEPARATED BY ' '.
  185.       CONDENSE dnis-NOM.
  186.       APPEND dnis.
  187.    ENDSELECT.
  188.  
  189. include <icon>.
  190.  
  191. at line-selection.
  192. data: cf,
  193.       prg(32),
  194.       v03 like sy-lisel.
  195. .
  196.    if sy-lsind = 1.
  197.       perform load_dump.
  198.    elseif sy-lsind = 2.
  199.       clear cf.
  200.       if sy-lisel cp '*program "*'.
  201.          cf = 'E'. perform trimea using 'program "' changing prg.
  202.       endif.
  203.       if sy-lisel cp '*program was "*' and cf is initial.
  204.          cf = 'E'. perform trimea using 'program was "' changing prg.
  205.       endif.
  206.       if sy-lisel cp '*programs "*' and cf is initial.
  207.          cf = 'E'. perform trimea using 'programs "' changing prg.
  208.       endif.
  209.       if sy-lisel cp '*function module "*' and
  210.          cf is initial.
  211.          cf = 'F'.
  212.          perform trimea using 'function module "' changing prg.
  213.       endif.
  214.       clear bi_tab. refresh bi_tab.
  215.       case cf.
  216.          when 'E'.
  217.          perform dynpro using: 'X' 'SAPLWBABAP' '0100',
  218.                                ' ' 'RS38M-PROGRAMM' prg,
  219.                                ' ' 'RS38M-FUNC_EDIT' 'X',
  220.                                ' ' 'BDC_OKCODE' '=SHOP'.
  221.          call transaction 'SE38' using bi_tab mode bi_mod.
  222.          when 'F'.
  223.          perform dynpro using: 'X' 'SAPMS38L' '1009',
  224.                                ' ' 'RS38L-NAME' prg,
  225.                                ' ' 'BDC_OKCODE' '=SHOW'.
  226.          call transaction 'SE37' using bi_tab mode bi_mod.
  227.       endcase.
  228.    endif.
  229.  
  230. end-of-selection.
  231.    if hoy = 'X' or ayer = 'X'. clear fecha. refresh fecha. endif.
  232.    if hoy = 'X'.
  233.        fecha-sign = 'I'.
  234.        fecha-option = 'EQ'.
  235.        fecha-low    = sy-datum.
  236.        append fecha.
  237.    endif.
  238.    if ayer = 'X'.
  239.        fecha-sign = 'I'.
  240.        fecha-option = 'EQ'.
  241.        fecha-low    = sy-datum - 1.
  242.        append fecha.
  243.    endif.
  244.    perform load_header.
  245.    perform write_header_2.
  246.  
  247. form trimea using cadena
  248.             changing salida.
  249. data: bkp like sy-lisel,
  250.       ax(2) type n.
  251.   bkp = sy-lisel.
  252.   search bkp for cadena.
  253.   ax = strlen( cadena ).
  254.   ax = sy-fdpos + ax.
  255.   shift bkp left by ax places.
  256.   shift bkp left deleting leading ' '.
  257.   search bkp for '"'.
  258.   ax = 0.
  259.   salida = bkp+ax(sy-fdpos).
  260. endform.
  261.  
  262. form dynpro using l_dynbegin l_name l_value.
  263.   clear bi_tab.
  264.   if not l_dynbegin is initial.
  265.      bi_tab-program  = l_name.
  266.      bi_tab-dynpro   = l_value.
  267.      bi_tab-dynbegin = l_dynbegin.
  268.   else.
  269.      bi_tab-fnam     = l_name.
  270.      bi_tab-fval     = l_value.
  271.   endif.
  272.   append bi_tab.
  273. endform.
  274.  
  275. form load_dump.
  276.    rs380-datum = snap_h-datum.
  277.    rs380-DATUM = snap_h-DATUM.
  278.    rs380-UZEIT = snap_h-UZEIT.
  279.    rs380-UNAME = snap_h-UNAME.
  280.    rs380-AHOST = snap_h-AHOST.
  281.    rs380-MODNO = snap_h-MODNO.
  282.    rs380-MANDT = snap_h-MANDT.
  283.    clear: ft, cerrid, cinclu, clinno, env, usr.
  284.    refresh: ft.
  285.    perform build_ft.
  286.    perform set_variable  using:
  287.                     'FC'   cerrid,     "Current error id
  288.                     'AI'   cinclu,     "Current include
  289.                     'AL'   clinno,     "Current line number
  290.                     'EN'   env,        "Environment
  291.                     'US'   usr.        "User dara
  292.    SY-PFKEY = '    '.
  293.    clear SY-UCOMM.
  294.   perform:
  295.            display_short_text,
  296.            display_user_explanation,
  297. *           display_user_hints,
  298.            display_error_description.
  299. *           display_hints.
  300.   perform:
  301. *             display_files,
  302. *             display_environment,
  303.              display_transaction,
  304.              display_position,
  305.              display_source_code,
  306.              display_system_fields,
  307.              display_variables.
  308. *             display_event_stack,
  309. *             display_internal_hints,
  310. *             display_c_stack,
  311. *             display_spool,
  312. *             display_loaded_programs.
  313. *             display_pxa,
  314. *             display_internal_tables,
  315. *             display_work_areas,
  316. *             display_storage,
  317. *             display_cont_cbs,
  318. *             display_end_of_list.
  319. endform.
  320.  
  321. form load_header.
  322. data: ax type i,
  323.       bx type i.
  324.   select count(*) from snap_beg where
  325.                         datum in fecha and
  326.                        seqno = '000'.
  327.   ax = sy-dbcnt.
  328.  
  329.   select count(*) from snap_beg where
  330.                         datum in fecha and
  331.                         uname = sy-uname and
  332.                         seqno = '000'.
  333.   bx = sy-dbcnt.
  334.   RS380-DATUM = sy-datum.
  335.   RS380-UZEIT = sy-uzeit.
  336.   Write: / 'Total Dumps ', bx, ' de ', ax.
  337. endform.
  338.  
  339. form write_header_2.
  340. data eax(3) type n.
  341.   select * from snap_beg into corresponding fields of table snap_h
  342.                            where datum in fecha and
  343.                                seqno = '000'.
  344.  
  345.   sort snap_h by datum descending uzeit descending.
  346.   loop at snap_h.
  347.      at first.
  348.         uline /001(122).
  349.      endat.
  350.      check snap_h-uname in users.
  351.      shift snap_h-flist left by 2 places.
  352.      eax = snap_h-flist+0(3).
  353.      shift snap_h-flist left by 3 places.
  354.      snap_h-flist = snap_h-flist+0(eax).
  355.      eax = strlen( snap_h-flist ).
  356.      if sy-uname = snap_h-uname.
  357.         format color col_heading on.
  358.      elseif sy-datum = snap_h-datum.
  359.         format color col_total on.
  360.      endif.
  361.      write: /001 sy-vline, '@10@' as icon hotspot.
  362.      if hoy = 'X' or ayer = 'X'.
  363.      else.
  364.      write:      sy-vline, snap_h-datum.
  365.      endif.
  366.      write:      sy-vline, snap_h-uzeit,
  367. *                 sy-vline, snap_h-ahost(12),
  368.                  sy-vline.
  369.      write:      snap_h-uname(12).
  370. data: falsonom like dnis-nom.
  371.      if snap_h-uname ne  dnis-dni.
  372.         read table dnis with key dni = snap_h-uname.
  373.         if sy-subrc ne 0.
  374.            clear dnis-nom.
  375.         endif.
  376.         falsonom = dnis-nom.
  377.      else.
  378.         falsonom = '     "       "'.
  379.      endif.
  380.      write:"      sy-vline, snap_h-mandt,
  381.                  sy-vline,
  382. *                 snap_h-modno,
  383.                  snap_h-flist+0(30),
  384.                  sy-vline,
  385.                  falsonom.
  386.      if sy-uname = snap_h-uname.
  387.         format color col_heading off.
  388.      elseif sy-datum = snap_h-datum.
  389.         format color col_total off.
  390.      endif.
  391.      write at 122 sy-vline.
  392.      hide: snap_h-datum,
  393.            snap_h-uzeit,
  394.            snap_h-ahost,
  395.            snap_h-uname,
  396.            snap_h-mandt,
  397.            snap_h-modno.
  398.  
  399.   endloop.
  400.   if sy-subrc eq 0 . uline /001(122). endif.
  401. endform.
  402.  
  403. include MS380I10.
  404. include MS380O10.
  405. include MS380F10.
  406. include MS380F20.