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: 

Selection Screen Button for Variant selection for ALV output

Former Member
0 Kudos

HI Gurus,

I have a scenario like:

I have created a selection screen, where in I need to have a BUTTON - when user clicks on this button - all the variants associated with the selection screen output ( output is an ALV list containing say 30 columns) - By selecting the appropriate variant user can filter the output.

I am using function module - LT_VARIANTS_READ_FROM_LTDX to get the list variants.

Please guide me on the exact steps to be followed.

Many Thanks,

Madan

6 REPLIES 6

Former Member
0 Kudos

Try the Function Module "REUSE_ALV_VARIANT_F4" to get all the variants for a particular report. This returns the selected variant, which get then be passed directly to the ALV display FM. You would also want to use the FM "REUSE_ALV_VARIANT_EXISTENCE" to check a valid entry.

Former Member
0 Kudos

Try Using the FM "REUSE_ALV_VARIANT_F4" to get all the layouts available for the report. This returns the selected variant which can directly be used in the FM call to Display the ALV. You might also want to use the FM "REUSE_ALV_VARIANT_EXISTENCE" to check the existence of a variant input by the user for validation. Probably you do not need a separate button, it can be handled using a normal parameter on the selection screen.

0 Kudos

Hi Rohit,

Thank you for your reply,

Can please elaborate more on this.

Thanks,

Madan

Former Member
0 Kudos

Which version of ALV are you using? The selection of the display variant is a method of the class you're using and should be automatic if you've set the parameters correctly on your first_display call.

Make sure the i_save = 'A'. This will allow you to save display variants.

*

  • Call table for 1st display. Table must be empty at beginning.

*

CALL METHOD g_alv_tree->set_table_for_first_display

EXPORTING

is_hierarchy_header = l_hierarchy_header

is_variant = g_variant

i_save = 'A'

i_default = 'X'

CHANGING

it_fieldcatalog = t_fieldcat_batch

it_outtab = t_display_batch_tab. "table must be empty !

This routine is called at_selection to pull in previously saved variants.

&----


*& Form F4_FOR_VARIANT

----


FORM f4_for_variant.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = g_variant

i_save = g_save

IMPORTING

e_exit = g_exit

es_variant = gx_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF g_exit = space.

p_vari = gx_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " F4_FOR_VARIANT

shishupalreddy
Active Contributor
0 Kudos

Hello

Please follow this ...

DATA : R_VARIANT LIKE DISVARIANT.

PARAMETERS : P_LAYOUT LIKE DISVARIANT-VARIANT.

INITIALIZATION .

R_VARIANT-report = sy-repid.

R_variant-variant = p_var.

PASS r_variant to resue_alv_grid_display or set_table_for)_fist_display method.

Still u can use RESUE_ALV_VARIANTS_F4 within AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_LAYOUT TO PROVIDE ALL THE ALYTOUS AVAIALBE .

REGARDS,

0 Kudos

Hi,

I've got the same problematic BUT I'm using ALV OO (SALV Table). I've got 1 selection subscreen and 1 SALV output field on the same dynpro.

So how can I display/implement the "Save Variants" and "Choose Variant" buttons?

Thanks for any help!

ZAYA