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

Former Member
0 Likes
1,897

Hi,

generally we will pass program name to alvvariant-report while getting F4 functionality and saving.

How to use variant-handle and variant-log_group incase if we have 2 variants on selection screen and 2 layouts we are handling in the same program using application toolbar button to toggle from one layout to another layout?

Thanks,

Sreedevi P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,134

What you can do is to pass a unique string (Say the Grid name) to the handle parameter. So, that way you can manage the variants for each of these grids indepentely.

That means wherever you are trying to fetch the layout of a specific grid you need to pass the grid name also to the handle. You need to pass these valies to the I_VARIANT so that while saving the layout the standard code also considers the same.

If it is for the same grid you can leave it blank and save multiple layouts with different names. Once that is done, you can dynamically set the layout using the SET_FRONTEND_LAYOUT method.

Regards,

Ravi

Note : Please mark the helpful answers and close the thread if the issue is resolved.

Message was edited by: Ravikumar Allampallam

Hi,

generally we will pass program name to alvvariant-report while getting F4 functionality and saving.

How to use variant-handle and variant-log_group incase if we have 2 variants on selection screen and 2 layouts we are handling in the same program using application toolbar button to toggle from one layout to another layout?

Thanks,

Sreedevi P

4 REPLIES 4
Read only

Former Member
0 Likes
1,135

What you can do is to pass a unique string (Say the Grid name) to the handle parameter. So, that way you can manage the variants for each of these grids indepentely.

That means wherever you are trying to fetch the layout of a specific grid you need to pass the grid name also to the handle. You need to pass these valies to the I_VARIANT so that while saving the layout the standard code also considers the same.

If it is for the same grid you can leave it blank and save multiple layouts with different names. Once that is done, you can dynamically set the layout using the SET_FRONTEND_LAYOUT method.

Regards,

Ravi

Note : Please mark the helpful answers and close the thread if the issue is resolved.

Message was edited by: Ravikumar Allampallam

Read only

0 Likes
1,134

Hi Ravi,

not able to get your points to solve the problem.

Could you pls. send code if you have,

like I am using FM's

1) 'REUSE_ALV_VARIANT_DEFAULT_GET'

MOVE sy-repid TO l_pgm. "report name (id)

MOVE 'A' TO l_variant_save. "'A' = standard and user-specific saving

CLEAR l_varianttab.

MOVE l_pgm TO l_varianttab-report.

l_varianttab-handle = 'ZF1K'.

l_varianttab-log_group = 6.

CALL FUNCTION <b>'REUSE_ALV_VARIANT_DEFAULT_GET'</b>

EXPORTING

i_save = l_variant_save

CHANGING

cs_variant = l_varianttab

EXCEPTIONS

wrong_input = 1

not_found = 2

program_error = 3

OTHERS = 4.

2) MOVE 'A' TO l_variant_save. "A = save

  • Display variant selection popup

CALL FUNCTION <b>'REUSE_ALV_VARIANT_F4'</b>

EXPORTING

is_variant = l_varianttab

i_save = l_variant_save

IMPORTING

e_exit = l_exit

es_variant = l_variantback

EXCEPTIONS

not_found = 2.

p_vari = l_variantback-variant.

3) CALL FUNCTION <b>'REUSE_ALV_HIERSEQ_LIST_DISPLAY'</b>

EXPORTING

i_callback_program = l_pgm

i_callback_pf_status_set = 'PF_STATUS'

i_callback_user_command = 'USER_COMMAND'

is_layout = layout

it_fieldcat = fieldcat[]

it_sort = sortcat[]

i_default = 'X'

i_save = gv_save

<b> is_variant = l_variantback</b>

it_events = eventcat[]

i_tabname_header = 'ALV_HDRTAB'

i_tabname_item = 'ALV_ITMTAB'

is_keyinfo = is_key

TABLES

t_outtab_header = alv_hdrtab

t_outtab_item = alv_itmtab

EXCEPTIONS

program_error = 1

OTHERS = 2.

By using above FM's how to resolve the problem of saving ALV variants using handle and log_group properties.

Hope you understood the problem. Pls. write to me incase if you need anything.

Thanks and Regards,

Sreedevi P

Read only

0 Likes
1,134

Sreedevi,

Here is what you need to do

DATA : WA_VARIANT LIKE DISVARIANT.

WA_VARIANT-REPORT = SY-REPID

WA_VARIANT-HANDLE = 'GRID1'

WA_VARIANT-USERNAME = SY-UNAME.

Now pass the WA_VARIANT for the REUSE_ALV_HIERSEQ_LIST_DISPLAY function and when the layout is saved the handle also gets saved.

So, now when you use REUSE_ALV_VARIANT_DEFAULT_GET / REUSE_ALV_VARIANT_F4, you need to pass the handle name also.

Regards,

Ravi

Note : Please mark all the helpful answers and close the thread if the issue is resolved.