Refreshing variant display on ALV grid

5 pts.
Tags:
ABAP
ALV grid
SAP List Viewer
I'm displaying an ALV grid on in a container on screen 100 which is called from screen 1000. The layout of the grid is defined by a variant which is selected from screen 1000. When returning to screen 1000 from screen 100, and selecting a new variant, the ALV grid on the container is not refrehsed and still displays the layout of the previous variant. How do I refresh the ALV to use the layout of the new variant? I would also like to display the description of the selected variant as a title for the ALV grid. How can I do this?
ASKED: October 10, 2008  8:47 AM
UPDATED: February 19, 2009  2:34 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mohansuri
    AGERINGER, Were you able to resolve your issue? I am facing a similar problem. Tried using Refresh_table_display and Set_table_for_first_display but neither seems to work. Please let me know how you solved the issue. Regards, Suri.
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following