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 up standard variant in ABAP report

Former Member
0 Kudos

Hi,

I would like to create a standard variant for running ABAP report so that users don't have to select the variant each time.

I know we can specify the variant name as a standard variant on changing query by SQ01 but is there any way to give the function in ABAP report?

Does anybody know how to code or set up to do that?

Thank you very much in advance.

Best regards,

Miki

Edited by: Miki Komatsu on May 20, 2011 9:46 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

When yo create a transaction for a report you can set a default variant.

7 REPLIES 7

Former Member
0 Kudos

When yo create a transaction for a report you can set a default variant.

0 Kudos

Hi j.ortiz

That means I can't set default variant if we run a report by SE38, right?

Thanks,

Best regards,

Miki

0 Kudos

Hi,

Check this:

[http://aq33.com/development-programming/Articles000146.html]

Rgs,

Lokesh.

0 Kudos

Hi,

Try defaulting the values for each selection screen fields (parameter/select option) in the ABAP program itself at the declaration part by using "DEFAULT".

Regards,

Harish

0 Kudos

Use the RS_VARIANT_CONTENTS FM

CALL FUNCTION 'RS_VARIANT_CONTENTS'
    EXPORTING
      report                      = sy-repid
      variant                     = 'PRUEBA' "Your Variant
*     MOVE_OR_WRITE               = 'W'
*     NO_IMPORT                   = ' '
     EXECUTE_DIRECT              = 'X'
*   IMPORTING
*     SP                          =
    tables
*     L_PARAMS                    =
*     L_PARAMS_NONV               =
*     L_SELOP                     =
*     L_SELOP_NONV                =
      valutab                     = VALUE_TAB
*     OBJECTS                     =
*     FREE_SELECTIONS_DESC        =
*     FREE_SELECTIONS_VALUE       =
   EXCEPTIONS
     VARIANT_NON_EXISTENT        = 1
     VARIANT_OBSOLETE            = 2
     OTHERS                      = 3  .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

The variant Reports are in VARI Table

Former Member
0 Kudos

See FM RS_SUPPORT_SELECTIONS

This will allow you to use a default variant or use different ones based on userid. See the documentation.

Rob

Former Member
0 Kudos

Thank you very much, everybody.

All answers helped me a lot!.

Best regards,

Miki