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

user specific variant (how to )

Former Member
0 Likes
588

Hi gurus,

i have made one report. in this report we need different layout.

i have user reuse_alv_grid_display .

our requirement is we want to create one default layout and other user specific layout.

so if user doen't have his ownlayout then we want to display default layout otherwise display that user specific layout.

i am not able to figure it out how it works in this function module.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = g_repid

i_structure_name = 'ZSDMATATP'

it_fieldcat = zfield

  • it_sort = sortcat[]

I_DEFAULT = 'X'

i_save = 'U'

is_variant = g_variant

  • IMPORTING

  • e_exit_caused_by_caller = exit_caused_by_caller

  • es_exit_caused_by_user = exit_caused_by_user

tables

t_outtab = display

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

please tell me where i made mistake.

Thanks,

Jignesh.

Hi gurus,

i have made one report. in this report we need different layout.

i have user reuse_alv_grid_display .

our requirement is we want to create one default layout and other user specific layout.

so if user doen't have his ownlayout then we want to display default layout otherwise display that user specific layout.

i am not able to figure it out how it works in this function module.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = g_repid

i_structure_name = 'ZSDMATATP'

it_fieldcat = zfield

  • it_sort = sortcat[]

I_DEFAULT = 'X'

i_save = 'U'

is_variant = g_variant

  • IMPORTING

  • e_exit_caused_by_caller = exit_caused_by_caller

  • es_exit_caused_by_user = exit_caused_by_user

tables

t_outtab = display

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

please tell me where i made mistake.

Thanks,

Jignesh.

1 REPLY 1
Read only

naimesh_patel
Active Contributor
0 Likes
438

1. Put one parameter on the screen like:

PARAMETERS : P_VAR LIKE DISVARIANT-VARIANT obligatory.

2. Assign the F4 help for that parameter

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VAR.
DATA:       W_VARIANT LIKE DISVARIANT.
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      IS_VARIANT    = W_VARIANT
      I_SAVE        = e_save        "Was 'A'
    IMPORTING
      ES_VARIANT    = W_VARIANT
    EXCEPTIONS
      NOT_FOUND     = 1
      PROGRAM_ERROR = 2
      OTHERS        = 3.
  IF SY-SUBRC EQ 0.
    P_VAR = W_VARIANT-VARIANT.
  ELSE.
    W_VARIANT-REPORT = SY-REPID.
  ENDIF.

3. Pass this W_VARIANT to FM

 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      IS_VARIANT         = W_VARIANT
.....

By this way, user has to select at least one variant. He can pull down the F4 help for avaliable variants. He can see the default one alongwith his own variants if he has any.

Regards,

Naimesh Patel