Creating variants for default values

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:
* 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'
              report  = tp_repid
              variant = tp_variant
              r_c     = tp_subrc
              others  = 9.

    if sy-subrc = 0.
      if not tp_subrc is initial.
        clear tp_variant.
        tp_variant = 'U_'.

    Requires Free Membership to View

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.