Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. REPORT ztest_check_boxes.
  2.  
  3. DATA: g_num_check_boxes TYPE i,
  4. g_num_cb_shown TYPE i,
  5. g_first_time TYPE abap_bool VALUE abap_true.
  6.  
  7. FIELD-SYMBOLS: <cb> TYPE flag,
  8. <text> TYPE any.
  9.  
  10. PARAMETERS: px_01 AS CHECKBOX MODIF ID cb,
  11. px_02 AS CHECKBOX MODIF ID cb,
  12. px_03 AS CHECKBOX MODIF ID cb,
  13. px_04 AS CHECKBOX MODIF ID cb,
  14. px_05 AS CHECKBOX MODIF ID cb,
  15. px_06 AS CHECKBOX MODIF ID cb,
  16. px_07 AS CHECKBOX MODIF ID cb,
  17. px_08 AS CHECKBOX MODIF ID cb,
  18. px_09 AS CHECKBOX MODIF ID cb,
  19. px_10 AS CHECKBOX MODIF ID cb.
  20.  
  21. INITIALIZATION.
  22.  
  23. " Determine the number of checkboxes to show,
  24. " for simplicity I just hard coded this
  25. g_num_check_boxes = 3.
  26.  
  27.  
  28. AT SELECTION-SCREEN OUTPUT.
  29.  
  30. g_num_cb_shown = 0.
  31.  
  32. LOOP AT SCREEN.
  33.  
  34. IF screen-group1 EQ 'CB'.
  35. " This will trigger on the check box
  36. " as well as their descriptions
  37.  
  38. IF g_num_cb_shown LT g_num_check_boxes.
  39. " Need to display this check box
  40. CASE screen-group3.
  41. WHEN 'PAR'.
  42. " This is the check box
  43. " you can set the value here dynamically.
  44. " Should only be done once
  45. IF g_first_time EQ abap_true.
  46. ASSIGN (screen-name) TO <cb>.
  47. IF ( g_num_cb_shown MOD 2 ) EQ 0.
  48. <cb> = 'X'.
  49. ENDIF.
  50. ENDIF.
  51.  
  52. WHEN 'TXT'.
  53. " This is the text, you could set this with
  54. " data from your database table
  55. ASSIGN (screen-name) TO <text>.
  56. <text> = `Checkbox ` && g_num_cb_shown.
  57.  
  58. " TXT comes after PAR, so we should do this here
  59. ADD 1 TO g_num_cb_shown.
  60.  
  61. ENDCASE.
  62.  
  63. ELSE.
  64. " Need to hide this check box
  65. screen-active = '0'.
  66. MODIFY SCREEN.
  67.  
  68. ENDIF. " Display?
  69.  
  70. ENDIF. " Check box?
  71.  
  72. ENDLOOP. " SCREEN
  73.  
  74. g_first_time = abap_false.
  75.  
  76. START-OF-SELECTION.
  77.  
  78. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement