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: 

show the drop down list of variant on the selection screen in ALV reports

Former Member
0 Kudos

Hi,

i have a alv report when i execute this display will come and then i click display layout it save as a variant on the selection screen and when i go back to selection screen and press f4 on the display variant its show the drop down list of varient.

can u send me some code for this functionality...its very urgent.

thanks!

Vipin

2 REPLIES 2

Former Member
0 Kudos

Hi,

Check the following link:

http://www.sapbrain.com

Regards,

Bhaskar

Former Member
0 Kudos

Hi,

try inserting this code apropietly in you program. (1 parameter + Initialization + At-selection-screen + 2 forms)

*----


START HERE

PARAMETERS: pa_vari TYPE disvariant-variant.

.

.

.

INITIALIZATION.

g_repid = sy-repid.

CLEAR e_variant.

e_variant-report = sy-cprog.

e_variant-username = sy-uname.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = 'A'

CHANGING

cs_variant = e_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 0.

pa_vari = e_variant-variant.

ENDIF.

.

.

.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.

PERFORM alv_variant_f4 CHANGING pa_vari.

.

.

.

&----


*& Form ALV_VARIANT_F4

&----


FORM alv_variant_f4 CHANGING pa_vari.

DATA: l_exit(1) TYPE c.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = e_variant

i_tabname_header = 'ANYTHING'

i_save = 'A'

IMPORTING

e_exit = l_exit

es_variant = e_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 l_exit = space.

pa_vari = e_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " ALV_VARIANT_F4

*----


END

Hope iy helps!

Alfonso