W Pub: ABAP Prog Propios RPT Dyn

  1. report zmysql .
  2. tables sscrfields.
  3. selection-screen comment /1(72) p1.
  4. selection-screen comment /1(72) p2.
  5. parameters: lin_1(72) lower case default '"HardCode Here',
  6.             lin_2(72) lower case,
  7.             lin_3(72) lower case,
  8.             lin_4(72) lower case,
  9.             lin_5(72) lower case,
  10.             lin_6(72) lower case,
  11.             lin_7(72) lower case,
  12.             lin_8(72) lower case,
  13.             lin_9(72) lower case,
  14.             lin_a(72) lower case,
  15.             lin_b(72) lower case,
  16.             lin_c(72) lower case,
  17.             lin_d(72) lower case,
  18.             lin_e(72) lower case,
  19.             lin_f(72) lower case,
  20.             lin_0(72) lower case.
  21. selection-screen comment /1(72) p3.
  22. selection-screen comment /1(72) p4.
  23. selection-screen function key 1.
  24. selection-screen function key 2.
  25.  
  26. * Syntax - Check
  27. data: f(240),
  28.       g type i,
  29.       h(72).
  30.  
  31. data: itab(72) occurs 0 with header line.
  32. data: bkp(72) occurs 0 with header line.
  33.  
  34. initialization.
  35.    p1 = p2 = p3 = p4 =
  36.                '** NO WARRANTY ** NO RESPONSABILITY ** NO WARRANTY ** '.
  37.    move 'Clear' to sscrfields-functxt_01.
  38.    move 'Check' to sscrfields-functxt_02.
  39.  
  40. at selection-screen.
  41.    case sscrfields-ucomm.
  42.       when 'FC01'.
  43.           clear: lin_1, lin_4, lin_5, lin_8, lin_9, lin_0, lin_a, lin_b,
  44.           lin_e, lin_d, lin_c, lin_f, lin_2, lin_3, lin_6, lin_7.
  45.       when 'FC02'.
  46.           perform crear_tabla.
  47.           syntax-check for itab message f line g word h.
  48.           if sy-subrc ne 0.
  49.              message s398(00) with 'MEC!! ' f g h. exit.
  50.           else.
  51.              message s398(00) with 'Good Job/Luck'.
  52.           endif.
  53.    endcase.
  54.  
  55. end-of-selection.
  56.    perform crear_sql.
  57.  
  58. form crear_sql.
  59.    perform crear_tabla.
  60.    syntax-check for itab message f line g word h.
  61.    if sy-subrc ne 0.
  62.       message s398(00) with 'MEC!! ' f g h. exit.
  63.    endif.
  64. * Histrico - Protect YourSelf!...
  65.    read report 'zmysql_test' into bkp.
  66.    loop at bkp.
  67.       if bkp cp '+rep*rt +mysql++est*' or
  68.          bkp cp '*"HardCode Here'.
  69.          delete bkp index sy-tabix.
  70.          continue.
  71.       endif.
  72.       check bkp+0(1) ne '*'.
  73.       concatenate '*' bkp into bkp.
  74.       if sy-subrc ne 0. bkp+0(1) = '*'. endif.
  75.       if bkp cp '+rep*rt +mysql++est*'.
  76.          delete bkp index sy-tabix.
  77.       else.
  78.          modify bkp index sy-tabix.
  79.       endif.
  80.    endloop.
  81.    append lines of bkp to itab.
  82. * In God's hands..
  83.    insert report 'zmysql_test' from itab state 'A'.
  84.    submit zmysql_test and return.
  85. endform.
  86.  
  87. form crear_tabla.
  88.    clear itab. refresh itab.
  89.    itab = 'report zmysql_test.'. append itab.                  "PE
  90. * CSI is over your step...
  91.    concatenate '" ' sy-datum '.' sy-uzeit ':' sy-uname into itab.
  92.    append itab.
  93. * Only one line to kill, the rest is for comment it...
  94.    if not lin_1 is initial. itab = lin_1. append itab. endif.
  95.    if not lin_2 is initial. itab = lin_2. append itab. endif.
  96.    if not lin_3 is initial. itab = lin_3. append itab. endif.
  97.    if not lin_4 is initial. itab = lin_4. append itab. endif.
  98.    if not lin_5 is initial. itab = lin_5. append itab. endif.
  99.    if not lin_6 is initial. itab = lin_6. append itab. endif.
  100.    if not lin_7 is initial. itab = lin_7. append itab. endif.
  101.    if not lin_8 is initial. itab = lin_8. append itab. endif.
  102.    if not lin_9 is initial. itab = lin_9. append itab. endif.
  103.    if not lin_a is initial. itab = lin_a. append itab. endif.
  104.    if not lin_b is initial. itab = lin_b. append itab. endif.
  105.    if not lin_c is initial. itab = lin_c. append itab. endif.
  106.    if not lin_d is initial. itab = lin_d. append itab. endif.
  107.    if not lin_e is initial. itab = lin_e. append itab. endif.
  108.    if not lin_f is initial. itab = lin_f. append itab. endif.
  109.    if not lin_0 is initial. itab = lin_0. append itab. endif.
  110. endform.