W Pub: ABAP Prog Propios RPT Pseudo

  1. REPORT znadar_pseudo .
  2.  
  3. TABLES: tstc, tstct.
  4.  
  5. PARAMETERS: prg LIKE d010sinf-prog,
  6. yncludes AS CHECKBOX DEFAULT ' '. "Incluye includes ?
  7.  
  8. DATA: vin(255) OCCURS 0 WITH HEADER LINE,
  9.       vout(255) OCCURS 0 WITH HEADER LINE,
  10.       di(255),
  11.       si(255),
  12.       ax TYPE I,
  13.       bx(2) TYPE n,
  14.       ebx(2) TYPE n,
  15. BEGIN OF itab OCCURS 0,
  16.   patron(255),
  17.   real(255),
  18.   cambia(255),
  19. END OF itab,
  20. BEGIN OF valores,
  21.   01(01), 02(02), 03(03), 04(04), 05(05), 06(06), 07(07), 08(08), 09(09),
  22.   10(10), 11(11), 12(12), 13(13), 14(14), 15(15), 16(16), 17(17), 18(18),
  23.   19(19), 20(20), 21(21), 22(22), 23(23), 24(24), 25(25), 26(26), 27(27),
  24.   28(28), 29(29), 30(30), 31(31), 32(32), 33(33), 34(34), 35(35), 36(36),
  25.   37(37), 38(38), 39(39),
  26. END OF valores,
  27. tree  LIKE snode OCCURS 10 WITH HEADER LINE,
  28. BEGIN OF vprog  OCCURS 0,
  29.   vprog LIKE d010sinf-prog,
  30. END OF vprog,
  31. BEGIN OF TMPTAB OCCURS 0.
  32.         INCLUDE STRUCTURE TEXTPOOL.
  33. DATA: END OF TMPTAB,
  34.       sytabix LIKE sy-tabix.
  35.  
  36. FIELD-symbols: <f>.
  37.  
  38. END-OF-selection.
  39.   CLEAR vprog.
  40.   REFRESH vprog.
  41.   vprog-vprog = prg. APPEND vprog.
  42.   PERFORM configurame.
  43.   LOOP AT vprog.
  44.     prg = vprog-vprog.
  45.     PERFORM load_prog.
  46.     CHECK sy-subrc EQ 0.
  47.     PERFORM lista_cabecera.
  48.     vout = '*'. APPEND vout.
  49.     vout = '* Documentación generada por DocumentThis! v0.1'.
  50.     APPEND vout.
  51.     vout = '* (C) CopyLeft 2004-2014'. APPEND vout.
  52.     vout = '*'. APPEND vout.
  53.     PERFORM engine.
  54.     PERFORM list_data.
  55.   ENDLOOP.
  56.  
  57.  
  58. FORM lista_cabecera.
  59.   DATA: current_treename(32),
  60.         oname LIKE tree-name,
  61.         err(1).
  62.   CONCATENATE 'PG_' prg INTO current_treename.
  63.   CALL FUNCTION 'WB_TREE_ACTUALIZE'
  64.     EXPORTING
  65.       tree_name        = current_treename
  66.       with_tcode_index = 'X'
  67.     IMPORTING
  68.       syntax_error     = err.
  69.   IMPORT tree FROM DATABASE dwtree(tr) ID current_treename.
  70.   vout = 'Descripción rápida del programa'.
  71.   CLEAR vout. APPEND vout.
  72.   LOOP AT tree.
  73.     vout = tree-name.
  74.     CHECK oname <> tree-name.
  75.     CASE tree-TYPE.
  76.       WHEN 'OI '.
  77.         READ TABLE  vprog WITH KEY vprog = tree-name.
  78.         IF sy-subrc NE 0 AND yncludes = 'X'.
  79.           vprog-vprog = tree-name.
  80.           APPEND vprog.
  81.         ENDIF.
  82.         SELECT SINGLE TEXT INTO vout FROM trdirt
  83.         WHERE name = tree-name AND
  84.         sprsl = sy-langu.
  85.         CONCATENATE tree-name ' - ' vout INTO vout
  86.         SEPARATED BY ' '.
  87.       WHEN 'OPD'.
  88.         IF tree-INCLUDE NE prg.
  89.           CONCATENATE vout ' (' tree-INCLUDE ')' INTO vout
  90.           SEPARATED BY ' '.
  91.         ENDIF.
  92.       WHEN 'OPZ'.
  93.         SELECT SINGLE TEXT INTO vout FROM rsmptexts
  94. WHERE  progname  = prg
  95. AND    sprsl     = sy-langu
  96. AND    obj_type  = 'T'
  97. AND    obj_code  = tree-name.
  98.         CONCATENATE tree-name ' - ' vout INTO vout
  99.         SEPARATED BY ' '.
  100.       WHEN 'OPT'.
  101.         SELECT SINGLE ddtext INTO vout FROM  dd02t
  102. WHERE  tabname     = tree-name
  103. AND    ddlanguage  = sy-langu.
  104.         CONCATENATE tree-name ' - ' vout
  105.         INTO vout SEPARATED BY ' '.
  106.       WHEN 'OT'.
  107.         SELECT SINGLE * FROM  tstc WHERE  tcode  = tree-name.
  108.         SELECT SINGLE * FROM tstct WHERE sprsl = sy-langu
  109.         AND tcode = tree-name.
  110.         CONCATENATE tstc-tcode ' - '
  111.         tstc-pgmna ' - '
  112.         tstc-dypno ' - '
  113.         tstct-ttext INTO vout SEPARATED BY ' '.
  114.     ENDCASE.
  115.     APPEND vout.
  116.     oname = tree-name.
  117.     CHECK tree-TYPE+0(1) = 'C'.
  118.     vout = '-------------------------------------------'. APPEND vout.
  119.     CLEAR vout. APPEND vout.
  120.   ENDLOOP.
  121.   READ TEXTPOOL PRG LANGUAGE SY-LANGU INTO TMPTAB.
  122.   LOOP AT tmptab.
  123.     AT FIRST.
  124.       vout = 'Textos'. APPEND vout.
  125.       vout = '-------------------------------------------'. APPEND vout.
  126.     ENDAT.
  127.     CLEAR vout.
  128.     IF tmptab-ID = 'I'. vout = 'TEXT-'. ENDIF.
  129.     CONCATENATE vout tmptab-KEY ':' tmptab-ENTRY INTO vout.
  130.     APPEND vout.
  131.   ENDLOOP.
  132. ENDFORM.
  133.  
  134. FORM list_data.
  135.   LOOP AT vout. WRITE: / vout. ENDLOOP.
  136. ENDFORM.
  137.  
  138. FORM load_prog.
  139.   CLEAR: vin, vout, di, ax, bx.
  140.   REFRESH: vin, vout.
  141.   READ REPORT prg INTO vin.
  142. ENDFORM.
  143.  
  144. FORM engine.
  145.   CLEAR si.
  146.   DESCRIBE TABLE vout LINES ax.
  147.   APPEND LINES OF vin TO vout.
  148.   CLEAR ebx.
  149.   LOOP AT vout INTO di FROM ax.
  150.     sytabix = sy-tabix.
  151.     CHECK di+0(1) NA '*"' AND NOT di IS INITIAL.
  152.     TRANSLATE di TO LOWER CASE.
  153.     IF di CP '*form*'.
  154.       IF di NP '*perform*' AND
  155.       di NP '*endform*' AND
  156.       di NP '*format*'.
  157.         REPLACE 'form' WITH 'subrutina' INTO di.
  158.       ENDIF.
  159.     ENDIF.
  160.     IF di CP '*if *' AND di NP '*endif*'.
  161.       REPLACE 'if' WITH 'pregunta si' INTO di.
  162.     ENDIF.
  163.     LOOP AT itab.
  164.       CHECK di CP itab-patron.
  165.       bx = STRLEN( itab-cambia ).
  166.       CONCATENATE 'valores-' bx INTO si.
  167.       bx = STRLEN( itab-real ).
  168.       ASSIGN (si) TO <f>.
  169.       <f> = itab-cambia.
  170.       REPLACE itab-real length bx WITH <f> INTO di.
  171.     ENDLOOP.
  172.     MODIFY vout FROM di INDEX sytabix.
  173.   ENDLOOP.
  174. ENDFORM.
  175.  
  176. FORM configurame.
  177. * Los espacios y el orden es muy importante
  178. * Tcalo bajo tu riesgo
  179.   PERFORM add_string USING:
  180.         '*like*'           'like' 'como',
  181.         '*type*'           'type' 'tipo',
  182.         '*loop at*'        'loop at' 'Bucle para',
  183.         '*endloop*'        'endloop' 'fin bucle',
  184.         '*check*'  'check'  'Continuar sólo si',
  185.         '*parameters*'      'parameters'  'parámetro de pantalla',
  186.         '*append*'          'append' 'a&ntilde;adir',
  187.         '*delete*'          'delete' 'borrar',
  188.         '*collect*'         'collect' 'a&ntilde;ade sumando',
  189.         '*modify*'          'modify' 'modificar',
  190.         '*update*'          'update' 'actualizar',
  191.         '*insert*'          'insert' 'insertar',
  192.         '*end-of-selection*' 'end-of-selection' 'Evento: Fin Selección',
  193.         '*initialization*'   'initialization' 'Evento: Inicialización',
  194.         '*top-of-page*'      'top-of-page'  'Evento: Cabecera',
  195.         '*at user-command*' 'at user-command'  'Evento: Pulsación',
  196.         '*start-of-selection*'  'start-of-selection' 'Evento: Inicio Seleccin',
  197.         '*at line-selection*'  'at line-selection' 'Evento: Lnea seleccionada',
  198.         '* where *'         'where' 'donde',
  199.         '* from *'          'from' 'desde',
  200.         '*endselect*'       'select' 'fin consulta',
  201.         '*select*'          'select' 'consulta',
  202.         '*single*'          'single' 'primer registro',
  203.         '*write*'           'write' 'escribir',
  204.         '*is initial*'      'is initial' 'está inicializado',
  205.         '*describe table*' 'describe table' 'descripción de tabla',
  206.         '*read table*'     'read table' 'leer tabla',
  207.         '*read line*'      'read line' 'leer lnea',
  208.         '*dataset*'        'dataset' 'juego de datos',
  209.         '*open *'          'open' 'abrir',
  210.         '*data*'           'data' 'crea variable',
  211.         '* do.*'           ' do.' 'repite',
  212.         '* do *'           ' do ' 'repite',
  213.         '* times*'         ' times' ' veces',
  214.         '*enddo*'          'enddo' 'fin repite',
  215.         '*perform*'        'perform' 'llamar a',
  216.         '*endform*'        'endform' 'fin de subrutina',
  217.         '*endif*'          'endif' 'fin pregunta',
  218.         '*while*'          'while' 'mientras',
  219.         '*endwhile*'       'endwhile' 'fin mientras',
  220.         '*clear*'          'clear'  'inicializa',
  221.         '*refresh*'        'refresh'  'limpia',
  222.         '*authority-check*' 'authority-check' 'Comprobar autorización',
  223.         '*replace*'         'replace' 'cambiar cadena',
  224.         '* cp *'            ' cp ' ' contiene patrón ',
  225.         '* np *'            ' np ' ' no contiene patrón ',
  226.         '* co *'            ' co ' ' contiene sólo ',
  227.         '* cn *'            ' cn ' ' no contiene nigún ',
  228.         '* ca *'            ' ca ' ' contiene algún ',
  229.         '* ne *'            ' ne ' ' difiere de ',
  230.         '* eq *'            ' eq ' ' es igual a ',
  231.         '* na *'            ' na ' ' no contiene algún ',
  232.         '* le *'            ' le ' ' menor o igual ',
  233.         '* lt *'            ' le ' ' menor ',
  234.         '* ge *'            ' le ' ' mayor o igual ',
  235.         '* gt *'            ' le ' ' mayor ',
  236.         '* eq *'            ' le ' ' igual ',
  237.         '* <> *'            ' <> ' ' diferente ',
  238.         '*and return'       'and return' 'y regresar',
  239.         '* and *'           ' and ' ' y ',
  240.         '* or *'            ' or ' ' o ',
  241.         '* with *'          ' with ' ' con ',
  242.         '* into *'          ' into ' ' meter en ',
  243.         '* to *'            ' to ' ' a ',
  244.         '*header*line*'     'header line' 'cabecera',
  245.         '* occurs *'        'occurs' 'occurrencias',
  246.         '*begin of*'  'begin of'  'estructura'  ,
  247.         '*end of*'  'end of'  'fin estructura'  ,
  248.         '*call function*'   'call function'  'Llamar a función',
  249.         '*exporting*'       'exporting'  'pasándole',
  250.         '*importing*'       'importing'  'recibiendo',
  251.         '*exceptions*'      'exceptions' 'errores',
  252.         '*continue*'        'continue' 'siguiente bucle',
  253.         '*exit*'            'exit'  'abandona proceso',
  254.         '* not *'           'not'  'no cumple',
  255.         '* add *'           'add'  'suma',
  256.         '*substract*'       'substract'  'resta',
  257.         '*divide*'          'divide' 'dividir',
  258.         '*starting*'        'starting' 'comenzando',
  259.         '*ending*'          'ending' 'finalizando',
  260.         '*multiply*'        'multiply'  'multiplicar',
  261.         '*concatenate*'     'concatenate'  'juntar cadenas',
  262.         '*field-symbols*'   'field-symbols'  'puntero',
  263.         '*include*'         'include'  'incluir fuente',
  264.         '*assign*'          'assign'  'asignar',
  265.         '*using*'           'using'  'pasando',
  266.         '*message*'         'message' 'mensaje',
  267.         '*decimals*'        'decimals' 'decimales',
  268.         '*elseif*'          'elseif'  'sino pregunta si',
  269.         '*else*'            'else' 'sino',
  270.         '*when *'           'when' 'cuando',
  271.         '*endcase*'  'endcase'  'final casos',
  272.         '* case *'  'case'  'Pregunta casos de',
  273.         '*move-corresponding*'  'move-corresponding'
  274.         'copia campos similares de',
  275.         '*move *'  'move'  'copia contenido de',
  276.         '*move:*'  'move:'  'copia contenido de',
  277.         '*max( *'  'max('  'valor máximo('  ,
  278.         '*min( *'  'min('  'valor mínimo('  ,
  279.         '*count(*'  'count('  'contar('  ,
  280.         '*table*'  'table'  'utilizar tabla',
  281.         '*begin of block*'  'begin of block'  'principio bloque'  ,
  282.         '*comment*'  'comment'  'comentario'  ,
  283.         '*new-page*'  'new-page'  'nueva pgina'  ,
  284.         '*separated by*'  'separated by'  'separar por'  ,
  285.         '*end of block*'  'end of block'  'fin bloque'  ,
  286.         '*raise*'  'raise'  'finalizar con'  ,
  287.         '*endselect*'  'endselect'  'fin consulta'  ,
  288.         '*call transaction*'  'call transaction'  'llamar a transaccion',
  289.         '*submit*'  'submit'  'ejecutar'  ,
  290.         '*and return*'  'and return'  'y regresa'  ,
  291.         '*ranges*'  'ranges'  'rangos'  ,
  292.         '*selection+screen*'  'selection-screen'  'pantalla'  ,
  293.         '*select+options*'  'select-options'  'parmetro multiple' ,
  294.         '*break-point*'  'break-point'  'interrupcion'  ,
  295.         '*translate*' 'translate' 'cambia',
  296.         '*changing*'  'changing'  'cambiando'  ,
  297.         '* by *'  ' by '  'por '  ,
  298.         '*sort *'  'sort'  'ordena',
  299.         '*format*' 'format' 'formato',
  300.         'uline' 'uline' 'subraya',
  301.         '*rollback work*' 'rollback work' 'retrocesión BBDDs',
  302.         '*commit work*' 'commit work' 'Monitoreo de BBDDs',
  303.         '*leave program*' 'leave program' 'salir del programa',
  304.         '*set screen*' 'set screen' 'poner pantalla',
  305.         '*call screen*' 'call screen' 'ejecutar pantalla',
  306.         '*call method*' 'call method' 'ejecutar método',
  307.         '*client specified*' 'client specified' 'especificando mandante',
  308.         '*end-of-definition*' 'end-of-definition' 'final definición',
  309.         '*unpack*' 'unpack' 'desempaqueta',
  310.         '*pack*' 'pack' 'empaqueta',
  311.         '*found*' 'found' 'encontrado',
  312.         '*shift*' 'shift' 'desplaza',
  313.         '*import *' 'import ' 'importar ',
  314.         '*export *' 'export ' 'exportar ',
  315.         '*memory id*' 'memory id ' 'identificación de memoria',
  316.         '*left deleting leading*'  'left deleting leading'
  317.         'a la izquierda borrando',
  318.         '*right deleting trailing*'  'right deleting trailing'
  319.         'a la derecha borrando',
  320.         '*places*' 'places' 'sitios',
  321.         '*uline*' 'uline' 'pintar raya',
  322.         '*in program*' 'in program' 'en el programa',
  323.         '*skip*' 'skip' 'linea en blanco',
  324.         '*read textpool*' 'read textpool' 'leer textos',
  325.         '*lines*' 'lines' 'lineas',
  326.         '*currency*' 'currency' 'con moneda',
  327.         '* field *' ' field ' ' campo ',
  328.         '* if *' ' if ' 'pregunta si',
  329.         '* method *' 'method' 'método',
  330.         'class *' 'class' 'clase',
  331.         '* implementation*' 'implementation' ' implementación',
  332.         '* definition' 'definicion' ' definición',
  333.         '* create object *' 'create object' 'crear objeto',
  334.         '* receiving *' 'receiving' 'recibiendo',
  335.         '*endmethod*' 'endmethod' 'fin método',
  336.         '*get reference of*' 'get reference of' 'devuelve referencia de',
  337.         '* at *' ' at ' ' en '.
  338. ENDFORM.
  339.  
  340. FORM add_string USING cad_01 cad_02 cad_03.
  341.   itab-patron = cad_01.
  342.   itab-real   = cad_02.
  343.   itab-cambia = cad_03.
  344.   TRANSLATE itab-cambia to LOWER CASE.
  345.   APPEND: itab.
  346. ENDFORM.