Application Development and Automation 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: 
Read only

Program Variant: Popup by User

peter_atkin
Active Contributor
0 Likes
2,376

Guys,

I have copied some standard code to automatically assign a variant via the Initialisation section (see RIAUFK20).

However, the client wants a popup to display all variants for the user so that they can choose the appropriate variant before the selection-screen is displayed.

Is there a suitable function module for this?

9 REPLIES 9
Read only

ferry_lianto
Active Contributor
0 Likes
1,477

Hi Peter,

You can use this FM <b>RS_VARIANT_CONTENTS</b> to retrieve all variants fo a program.

Hope this will help.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,477

Do you mean:


PARAMETERS   p_var LIKE disvariant-variant
                   DEFAULT '/STANDARD'.
DATA: g_variant          LIKE disvariant.
DATA: gx_variant         LIKE disvariant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
  PERFORM variant_inputhelp_f14 USING p_var.

*---------------------------------------------------------------------*
*       FORM VARIANT_INPUTHELP_F14                                    *
*---------------------------------------------------------------------*
FORM variant_inputhelp_f14 USING p_variant LIKE g_variant-variant.

  DATA h_exit.

  CLEAR gx_variant.

  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
       EXPORTING
            is_variant          = g_variant
*           I_TABNAME_HEADER    =
*           I_TABNAME_ITEM      =
*           IT_DEFAULT_FIELDCAT =
            i_save              = g_variant_save
       IMPORTING
            e_exit              = h_exit
            es_variant          = gx_variant
        EXCEPTIONS
            not_found           = 1
            program_error       = 2
            OTHERS              = 3.

  IF sy-subrc IS INITIAL AND h_exit IS INITIAL.
    g_variant-variant = gx_variant-variant.
    p_variant         = gx_variant-variant.
  ELSE.
    MESSAGE ID sy-msgid TYPE 'S'
                 NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.

Rob

Read only

Former Member
0 Likes
1,477

Hi,

If you want to get the variant for ALV display then use the above solution. If you want to use the ABAP program variant then use function module

CALL FUNCTION 'RS_VARIANT_CATALOG'

EXPORTING

REPORT = Report Name

DYNNR = Blank

INTERNAL_CALL = 'X'

variant = If you want to pass a

pattern

POP_UP = 'X' is you want popup

for selecting variant

IMPORTING

SEL_VARIANT = variant name passed back

TABLES

BELONGING_DYNNR = BELONGING_DYNNR

EXCEPTIONS

NO_REPORT = 01

REPORT_NOT_EXISTENT = 02

REPORT_NOT_SUPPLIED = 03.

You can try calling it at Initialization Event. Good luck

thanks

Read only

0 Likes
1,477

you can also use

RS_PROGRAM_POPUP_VARIANT

Regards

Raja

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,477

hi

Use following Function module

RS_F4_INFO_VARIANT

RS_PROGRAM_POPUP_VARIANT

RS_ALL_VARIANTS_4_1_REPORT

RS_GET_SCREENS_4_1_VARIANT

RS_VARIANT_DISPLAY

regards

vinod

Read only

peter_atkin
Active Contributor
0 Likes
1,477

Guys,

I'd already checked most of these...

I was trying to get a list of those variants <b>ONLY</b> for the user who is currently logged-on.

I've seen this function somewhere before - but I can't remember where!!!

Message was edited by: Peter Atkin

Read only

0 Likes
1,477

RS_HDSYS_CLIENT_COPY_VARIANT

Read only

0 Likes
1,477

Peter - check the documentation for the FM I mentioned (REUSE_ALV_VARIANT_F4). It has a parameter (IS_VARIANT) that allows you to enter the user name.

Rob

Read only

Former Member
0 Likes
1,477

Hi,

I think this is what is needed by you. Use function module "RS_VARIANT_FETCH",

Importing

FUNCTION - 'GET'

REPORT - 'PROGRAM NAME'

RKEY - This is a structure please fill in the

program name

SUBMODE - Blank

DYNNR - Normally this is 1000 but if you are

calling this for ur own defined selection

screen then use that number

INTERNAL_CALL - Blank

The output for the selected variant will be in P_VARI table.

Hope this was helpful.

thanks