‎2009 Mar 13 6:25 PM
Hi Folks,
I want to create an ALV report, whose output should vary with the users basing upon some condition. can anybody tell me how to do it?
regards,
santosh
‎2009 Mar 14 1:06 PM
Hi,
What you can do is use the concept of variants.
Create variants as per our layout requirements and take a parameter for variant on selection screen with a F4 help.
When user selects a variant, validate it and then display appropriate data.
Kindly refer this wiki code by me and refer to the use of variant in ALV:-
Hope this helps you.
Regards,
Tarun
‎2009 Mar 13 6:35 PM
Hi,
Can you give us more information on this...
If you want to have the different layout sets then save the layouts initially,
and then pass the same layout set name depending on the user.
Regards,
Venkatesh
‎2009 Mar 13 6:38 PM
Hi Venkatesh,
I tried doing that what you said but it didn't work. If you don't mind could you please supply me the code ?
Regards,
Santosh
‎2009 Mar 13 6:45 PM
Hi,
You can use the different layout sets.
First display the ALV with all the fields and then depending on the user, select fields and then save this layout.
Now in the selection, use a field called Layout -
PARAMETERS: p_var07 TYPE disvariant-variant .
now use a f4 help for this.
DATA: l_exit TYPE char1 .
DATA: gs_vari TYPE disvariant .
gs_vari-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_vari
i_save = 'A'
IT_DEFAULT_FIELDCAT =
IMPORTING
e_exit = l_exit
es_variant = gs_vari
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 EQ space .
p_p_var07 = gs_vari-variant .
ENDIF
Now pass this to grid functionmodule
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = gs_layout............................................................
Regards,
Venkatesh
‎2009 Mar 13 7:04 PM
Initially create a universal field catalog, then according the user inputs , delete the output fields from field catalog.
so in alv output are derived on the basis of field catalog.
a®
‎2009 Mar 14 1:06 PM
Hi,
What you can do is use the concept of variants.
Create variants as per our layout requirements and take a parameter for variant on selection screen with a F4 help.
When user selects a variant, validate it and then display appropriate data.
Kindly refer this wiki code by me and refer to the use of variant in ALV:-
Hope this helps you.
Regards,
Tarun
‎2009 Mar 14 5:12 PM