Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set variant as default for report.

Former Member
0 Kudos

Hello,

I have created a variant for a report and I want to set it as default. So that it is "loaded" together with the report. Anyone knows how to do this.

/Best Regards

Claes

1 ACCEPTED SOLUTION

Former Member

CLaes - you can use FM RS_SUPPORT_SELECTIONS using the report name and variant name at the INITIALIZATION event. The report will start with the variant loaded. You can also use some logic and load with different variants if needed.

Rob

6 REPLIES 6

Former Member
0 Kudos

Hi

You should create a Z-transaction to run that report using default variant.

Max

former_member188685
Active Contributor

Hi,

Create the transaction code for the report using SE93.

Choose the radio button 2 , i.e it is selection screen and report.

and then while filling data

Transaction text

Report

Program

Selection screen 1000

<b>Start with variant</b>

Authorization object

specify the variant, then it will start with that variant.

regards

vijay

Former Member

CLaes - you can use FM RS_SUPPORT_SELECTIONS using the report name and variant name at the INITIALIZATION event. The report will start with the variant loaded. You can also use some logic and load with different variants if needed.

Rob

0 Kudos

In practice, if all users were supposed to have their own variant set up for the program with the name of their USERID, you would:


INITIALIZATION.

  DATA: h_repid   LIKE rsvar-report,
        h_variant LIKE rsvar-variant.

  h_repid = sy-repid.
  h_variant = sy-uname.

  CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
       EXPORTING
            report               = h_repid
            variant              = h_variant
       EXCEPTIONS
            variant_not_existent = 01
            variant_obsolete     = 02.
  IF sy-subrc NE 0.
    CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
         EXPORTING
              report               = h_repid
              variant              = 'DEFAULT'
         EXCEPTIONS
              variant_not_existent = 01
              variant_obsolete     = 02.
  ENDIF.

You would also set up the DEFAULT variant for users without their own one.

Rob

0 Kudos

Here is a simular solution.



report zrich_0003 .


parameters: p_check type c.

initialization.

  data: begin of l_rkey,
              report like rsvar-report,
              variant like rsvar-variant.
  data: end of  l_rkey.

  data:
    l_report like  rsvar-report,
    l_variant like  rsvar-variant,
    l_mandt type sy-mandt,
    imp_subrc type sy-subrc.

  l_mandt = sy-mandt.
  l_report = sy-repid.
  l_variant = 'TEST'.            " Name of the variant goes here

  l_rkey-report  = l_report.
  l_rkey-variant = l_variant.

  perform %_import_vari_clnt in program (l_report)
                             using l_rkey imp_subrc l_mandt
                             changing imp_subrc
                             if found.

Regards,

Rich Heilman

0 Kudos

This message was moderated.