Selektionsvariante Besitzer ändern – Tabelle VARID

Hier ein interessantes Codesnippet, das ich noch nicht ausprobiert habe, dass den Besitzer einer Selektionsvariante ändert.

...
PARAMETERS pm_rep type progname DEFAULT 'ZXXXX'.  "Name des Programmes
parameters pm_nus type sy-uname default sy-uname.    "der neue "Besitzer" der geschützten Varianten
parameters pm_upd as CHECKBOX default ' '.                  "
...
* Hier noch Berechtigungsprüfungen
...
perform set_varid.
...
*&---------------------------------------------------------------------*
*&      Form  set_varid
*&---------------------------------------------------------------------*
form set_varid .
  data it_varid            type table of varid.
  field-symbols <fs_varid> type varid.
  data ab_varid            type varid.
  data ab_vari             type vari.

  select * from  varid CLIENT SPECIFIED
           into  table it_varid
           where report = pm_rep.

  loop at it_varid ASSIGNING <fs_varid>.
      if <fs_varid>-protected = 'S'.
         write : / <fs_varid>-mandt,
                   <fs_varid>-report,
                   <fs_varid>-variant,
                   <fs_varid>-protected,
                   <fs_varid>-ename,
                   <fs_varid>-aename.
         if pm_upd = 'X'.
             <fs_varid>-ename  = pm_nus.
             <fs_varid>-aename = pm_nus.
             update varid  client specified
                    from <fs_varid>.
         endif.

      endif.
  endloop.
endform.                    " set_varid