Creating variants for default values

You can automatically use an existing variant to fill your report parameters and selections during the event initialization.

You can automatically use an existing variant to fill your report parameters and selections during the event initialization. How? Just use function module 'RS_SUPPORT_SELECTIONS'. Check out our CtacAlign standard template for a variant of this solution:
- store a variant with name U_<userid> or U_<systemid>.
- Call this function during initialization
=> the values of the variant are sent to your selection-screen automatically.
This function works up to release 4.6C.
function /ctac/variant_start.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(RE_SYST) TYPE  SYST
*"----------------------------------------------------------------------
*
* This function checks if there are variants with a specific name and
* propose these values on selection screen
* Use this function in the INITIALIZATION event of your report

  data: tp_subrc   like sy-subrc.
  data: tp_repid   like rsvar-report.
  data: tp_variant like rsvar-variant.
 
    tp_repid = re_syst-repid.
    clear tp_variant.
    tp_variant = 'U_'.
    write re_syst-uname to tp_variant+2.

    call function 'RS_VARIANT_EXISTS'
         exporting
              report  = tp_repid
              variant = tp_variant
         importing
              r_c     = tp_subrc
         exceptions
              others  = 9.

    if sy-subrc = 0.
      if not tp_subrc is initial.
        clear tp_variant.
        tp_variant = 'U_'.
        write re_syst-sysid to tp_variant+2.

        call function 'RS_VARIANT_EXISTS'
             exporting
                  report  = tp_repid
                  variant = tp_variant
             importing
                  r_c     = tp_subrc
             exceptions
                  others  = 9.
        check sy-subrc = 0.
      endif.

      if tp_subrc = 0.
        call function 'RS_SUPPORT_SELECTIONS'
             exporting
                  report               = tp_repid
                  variant              = tp_variant
             exceptions
                  variant_not_existent = 01
                  variant_obsolete     = 02.
      endif.

    endif.
 
*
endfunction.
This was first published in October 2003

Dig deeper on SAP Basis administration and NetWeaver administration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close