W Pub: ABAP Prog Propios RPTZ Textos

  1. REPORT ZNADAR .
  2. * 'Pruebas'
  3. *  DISCLAIMER: EL AUTOR NO SE HACE RESPONSABLE DEL MAL USO DE ESTE PRG.
  4. *
  5. DATA: BEGIN OF SRC OCCURS 0,
  6.         TXT(72),
  7.       END OF SRC,
  8.       AUX(72),
  9.       AUX2(72).
  10. DATA: BEGIN OF TEXTIN,
  11.         CAB(5) VALUE 'TEXT-',
  12.         CONTA(3) TYPE N VALUE '000',
  13.       END OF TEXTIN.
  14.  
  15. DATA: BEGIN OF TMPTAB OCCURS 0.
  16.         INCLUDE STRUCTURE TEXTPOOL.
  17. DATA: END OF TMPTAB.
  18. SELECTION-SCREEN COMMENT 1(80) TEXT-001.
  19. PARAMETERS: PRG LIKE D010SINF-PROG,
  20.             SAVEME AS CHECKBOX DEFAULT ' '.
  21.  
  22. REFRESH SRC.
  23.  
  24. PERFORM IDIOMAS.
  25.  
  26. READ REPORT PRG INTO SRC.
  27. CHECK SY-SUBRC EQ 0.
  28. DATA: CONTA LIKE SY-FDPOS,
  29.       DF TYPE I.
  30.  
  31. LOOP AT SRC.
  32.   TRANSLATE SRC-TXT USING ' ¬'.
  33.   AUX = SRC-TXT. TRANSLATE AUX TO UPPER CASE.
  34.   SEARCH AUX FOR 'FUNCTION'.
  35.   CHECK SY-SUBRC NE 0.
  36.   SEARCH SRC-TXT FOR ''''.
  37.   CHECK SY-SUBRC EQ 0.
  38.   CONTA = SY-FDPOS.
  39.   AUX = SRC-TXT+0(CONTA).
  40.   ADD 1 TO CONTA.
  41.   SHIFT SRC-TXT BY CONTA PLACES.
  42.   DF = 1.
  43.   WHILE SY-SUBRC EQ 0.
  44.      SEARCH SRC-TXT FOR ''''.
  45.      CHECK SY-SUBRC EQ 0.
  46.      CONTA = SY-FDPOS.
  47.      IF DF = 1.
  48.        ADD 1 TO TEXTIN-CONTA.
  49.        CONCATENATE AUX TEXTIN INTO AUX.
  50.        DF = 0. CLEAR TMPTAB.
  51.        TMPTAB-ID = 'I'. TMPTAB-KEY = TEXTIN-CONTA.
  52.        MOVE SRC-TXT+0(CONTA) TO TMPTAB-ENTRY+0(CONTA).
  53.        TRANSLATE TMPTAB-ENTRY USING '¬ '.
  54.        TMPTAB-LENGTH = STRLEN( TMPTAB-ENTRY ).
  55.        APPEND TMPTAB.
  56.        ADD 1 TO CONTA.
  57.      ELSE.
  58.        DF = 1.
  59.        CLEAR AUX2.
  60.        MOVE SRC-TXT+0(CONTA) TO AUX2+0(CONTA).
  61.        CONCATENATE AUX AUX2 INTO AUX. ADD 1 TO CONTA.
  62.      ENDIF.
  63.     SHIFT SRC-TXT BY CONTA PLACES.
  64.   ENDWHILE. CLEAR AUX2.
  65.   CONTA = STRLEN( SRC-TXT ).
  66.   MOVE SRC-TXT+0(CONTA) TO AUX2+0(CONTA). CONCATENATE AUX AUX2 INTO AUX.
  67.   TRANSLATE AUX USING '¬ '.
  68.   SRC-TXT = AUX.
  69.   MODIFY SRC.
  70. ENDLOOP.
  71. DATA: FF(240), GG TYPE I, HH(72).
  72. SYNTAX-CHECK FOR SRC MESSAGE FF LINE FF WORD HH.
  73. CHECK SY-SUBRC EQ 0.
  74. CHECK SAVEME = 'X'.
  75. INSERT TEXTPOOL PRG LANGUAGE SY-LANGU FROM TMPTAB.
  76. INSERT REPORT PRG FROM SRC.
  77.  
  78. FORM IDIOMAS.
  79.   READ TEXTPOOL PRG LANGUAGE SY-LANGU INTO TMPTAB.
  80.   PERFORM LASTONE.
  81. ENDFORM.
  82.  
  83. FORM LASTONE.
  84.  LOOP AT TMPTAB WHERE ID = 'I'.
  85.     CHECK TMPTAB-KEY+0(1) CO '0123456789'.
  86.     CHECK TMPTAB-KEY+1(1) CO '0123456789'.
  87.     CHECK TMPTAB-KEY+2(1) CO '0123456789'.
  88.     IF TMPTAB-KEY > TEXTIN-CONTA.
  89.        TEXTIN-CONTA = TMPTAB-KEY.
  90.     ENDIF.
  91.  ENDLOOP.
  92. ENDFORM.