rplantiko

List values of many variants / reports

Jan 25th, 2021 (edited)
1,567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 2.45 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report ZUT_LIST_VARIANT_VALUES
  3. *&---------------------------------------------------------------------*
  4. *& Selektionen und Parameter mehrerer Varianten / Reports auflisten
  5. *&---------------------------------------------------------------------*
  6. report zut_list_variant_values.
  7.  
  8. tables: varid.
  9.  
  10. * ----------------------------------------------------------------------
  11. * ZSPARAMS and ZSPARAMS_TAB are defined as a DDIC type in our system
  12. * To make the report self-contained, I include them here as local types
  13. * ----------------------------------------------------------------------
  14. types:
  15.   begin of zsparams,
  16.     report type repid,
  17.     variant type variant.
  18.     include type rsparams.
  19. types:
  20.   end of zsparams,
  21.   zsparams_tab type standard table of zsparams
  22.    with non-unique default key.
  23. * ----------------------------------------------------------------------
  24.  
  25. select-options:
  26.   s_report  for varid-report,
  27.   s_varid   for varid-variant.
  28.  
  29. start-of-selection.
  30.   perform start.
  31.  
  32. form start.
  33.  
  34.   if s_report[] is initial and
  35.      s_varid[] is initial.
  36.     message 'Bitte die Selektion einschränken' type 'I'.
  37.     return.
  38.   endif.
  39.  
  40.   data: lt_params type zsparams_tab.
  41.   perform select changing lt_params.
  42.   perform display changing lt_params.
  43.  
  44. endform.
  45.  
  46. form select changing ct_params type zsparams_tab.
  47.  
  48.   data: lt_values  type rsparams_tt,
  49.         ls_variant type zsparams.
  50.  
  51.   select report, variant from varid into @ls_variant
  52.            where report in @s_report
  53.              and variant in @s_varid.
  54.  
  55.     call function 'RS_VARIANT_VALUES_TECH_DATA'
  56.       exporting
  57.         report               = ls_variant-report
  58.         variant              = ls_variant-variant
  59.       tables
  60.         variant_values       = lt_values
  61.       exceptions
  62.         variant_non_existent = 1
  63.         variant_obsolete     = 2
  64.         others               = 3.
  65.     check sy-subrc eq 0.
  66.  
  67.     loop at lt_values into ls_variant-params.
  68.       append ls_variant to ct_params.
  69.     endloop.
  70.  
  71.   endselect.
  72.  
  73. endform.
  74.  
  75. form display changing ct_params type zsparams_tab.
  76.  
  77.   call function 'REUSE_ALV_GRID_DISPLAY'
  78.     exporting
  79.       i_structure_name = 'ZSPARAMS'
  80.     tables
  81.       t_outtab         = ct_params
  82.     exceptions
  83.       program_error    = 1
  84.       others           = 2.
  85.  
  86.   if sy-subrc <> 0.
  87.     message 'Fehler beim Aufruf des ALV Grid' type 'I'.
  88.   endif.
  89.  
  90. endform.
Add Comment
Please, Sign In to add comment