2010 Jun 11 1:29 PM
hi all,
i had an requirement to develop an alv report and in the output it contains g/l account field it displays the same content 10 times repeatedly and the requirement is at first i had to display only one time and the remaining 9 times it has to display empty.
regards,
karthik
2010 Jun 11 2:06 PM
You can sort those fields and in that way it will only show the content in the first record.
Use structure of type slis_t_sortinfo_alv and when calling the FM use that table.
data : s_sort TYPE slis_t_sortinfo_alv.
l_sort-spos = 1.
l_sort-fieldname = 'PERNR'.
l_sort-up = 'X'.
APPEND l_sort TO s_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'ALV_ST'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
i_background_id = 'ALV_BACKGROUND'
it_sort = gs_sort
i_save = 'A'
is_variant = gs_variant
it_events = gt_events
it_event_exit = ft_event_exit
TABLES
t_outtab = t_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
hi all,
i had an requirement to develop an alv report and in the output it contains g/l account field it displays the same content 10 times repeatedly and the requirement is at first i had to display only one time and the remaining 9 times it has to display empty.
regards,
karthik
2010 Jun 11 2:06 PM
You can sort those fields and in that way it will only show the content in the first record.
Use structure of type slis_t_sortinfo_alv and when calling the FM use that table.
data : s_sort TYPE slis_t_sortinfo_alv.
l_sort-spos = 1.
l_sort-fieldname = 'PERNR'.
l_sort-up = 'X'.
APPEND l_sort TO s_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'ALV_ST'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
i_background_id = 'ALV_BACKGROUND'
it_sort = gs_sort
i_save = 'A'
is_variant = gs_variant
it_events = gt_events
it_event_exit = ft_event_exit
TABLES
t_outtab = t_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
2010 Jun 11 2:26 PM
2010 Jun 12 6:53 PM
Hi,
You can sort your internal table and then can delete the duplicate entries from it. If your business need requires you to insert empty rows then you can probably insert some empty rows in it.
DELETE ADJACENT DUPLICATES FROM ITAB.
Hope this helps.
Thanks,
Samantak.
2010 Jun 13 7:02 PM
Why dont you use a hierarchical sequential alv ?
There are lot of examples in SDN.
@Samantak - Inseritng duplicate lines will create problem when user clicks the sort button
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |