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 can i set variant in alv ?

Former Member
0 Kudos

I using this method but i can't get solution this way

How can i do this ?




data tab2 type DISVARIANT .

tab2-REPORT = sy-repid.

tab2-VARIANT = '/0010/'.   "Variant Name

tab2-username = sy-uname.




call method r_grid->set_variant

         exporting

            is_variant             = tab2

           i_save                 = 'A'.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Burak,

Are you trying to set the variant before the table is displayed? If so, you should be passing tab2 to the parameter IS_VARIANT in the method SET_TABLE_FOR_FIRST_DISPLAY.

If you are trying to change the variant after the table is displayed (eg: based on user action), then you need to check if the variant exists using GET_VARIANT and if yes, then use SET_VARIANT and then call REFRESH_TABLE_DISPLAY.

Thanks,

Vikram.M

3 REPLIES 3

Former Member
0 Kudos

Burak,

Are you trying to set the variant before the table is displayed? If so, you should be passing tab2 to the parameter IS_VARIANT in the method SET_TABLE_FOR_FIRST_DISPLAY.

If you are trying to change the variant after the table is displayed (eg: based on user action), then you need to check if the variant exists using GET_VARIANT and if yes, then use SET_VARIANT and then call REFRESH_TABLE_DISPLAY.

Thanks,

Vikram.M

0 Kudos

i did and variant change in background. i check using get_variant method but variant still doesn't change

Node : also i use the refresh method

0 Kudos

Check if variant is actually a user variant (I've some doubt with a name starting with "/" ) if no, clear the user subfield in disvariant structure.

NB: in case of doubt, browse table LTDX.

Regards,

Raymond