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

Alv variant help

dev_parbutteea
Active Contributor
0 Likes
576

HI, i need to add a variant to selection screen in order to modify the layout of my alv.does anyone know how to do this .thx?

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
559

as far as I remember sy-variant is a system variable which you can use.

HI, i need to add a variant to selection screen in order to modify the layout of my alv.does anyone know how to do this .thx?

3 REPLIES 3
Read only

former_member156446
Active Contributor
0 Likes
560

as far as I remember sy-variant is a system variable which you can use.

Read only

dev_parbutteea
Active Contributor
0 Likes
559

how do i proceed then?thx.

Read only

MusAbaper
Active Participant
0 Likes
559

Hi,

I wish that this code will help you :

data : w_gx_variant like disvariant.

selection-screen begin of block b5 with frame title text-t01.

*- Display variant

parameters: p_vari like disvariant-variant. "obligatory.

selection-screen comment 47(40) varname for field p_vari.

selection-screen end of block b5.

form pai_of_selection_screen.

if not p_vari is initial.

  • Vérification de l'existence de la variante saisie

clear w_gx_variant.

clear w_gx_variant-variant.

move w_g_variant to w_gx_variant.

move p_vari to w_gx_variant-variant.

call function 'REUSE_ALV_VARIANT_EXISTENCE'

exporting

i_save = w_g_save

changing

cs_variant = w_gx_variant.

w_g_variant = w_gx_variant.

varname = w_g_variant-text.

else.

varname = ''.

endif.

endform. " pai_of_selection_screen

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = w_g_repid

is_layout = t_layout

it_fieldcat = t_fieldcat

i_default = 'X'

i_save = w_g_save

*/////////////////////////////////////////////////

is_variant = w_g_variant

*/////////////////////////////////////////////////

it_events = t_events

importing

es_exit_caused_by_user = t_exit

tables

t_outtab = t_edition

exceptions

program_error = 1

others = 2.

Reward if it helpful.

Mustapha