04-02-2008 3:25 PM
Hi all,
I am facing problem when tried to display header in alv.
I have One basic Alv report clicking on particular record corresponding data containing another ALV report displays .
Now i want to change the header text info for primary ALV and secondary ALV.
Any suggestion welcome.
Regards,
04-02-2008 3:32 PM
Hi,
Do you mean you want to change the column headers ? That can be done by changing the fieldcatalog, attribute COLTEXT.
kr,
Peter
04-02-2008 3:39 PM
No i want to change the header text and some colulmns too.
I need solution for header text.
Regards,
04-03-2008 8:26 AM
Navdeep singh,
Just follow these steps
1.
Define 2 events internal tables for 2 output as u r not using same Header text for 2 ALV outputs
data :
2.
Build events table .
i_events_p type slis_t_event, "Primary ALV
i_events_s type slis_t_event, "for Secondary ALV
w_events like line of i_events.
w_events-name = 'TOP_OF_PAGE' .
w_events-form = 'TOP_OF_PAGE_P' .
append w_events to i_events_p.
clear w_events.
3.
pass this events tables through REUSE_ALV_GRID_DISPLAY in Primary ans Secondary.
4.
Callback subroutines for TOP_OF_PAGE event.
w_events-name = 'TOP_OF_PAGE' .
w_events-form = 'TOP_OF_PAGE_S' .
append w_events to i_events_s.
clear w_events.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page_p.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
w_header-typ = 'S'.
w_header-info = 'XYZ Pte Ltd'.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'H'.
w_header-info = sy-repid.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
endform.
5.
If you want to change the Columns text manually.build fieldcatalog manually or set text for the field using seltext_m or seltext_l or seltext_s in the fieldcatalog internal table.
check below.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page_s.
DATA :
li_header TYPE slis_t_listheader,
w_header LIKE LINE OF li_header.
w_header-typ = 'S'.
w_header-info = 'XYZ Pte Ltd'.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'H'.
w_header-info = sy-repid.
APPEND w_header TO li_header.
CLEAR w_header.
w_header-typ = 'A'.
w_header-info = sy-title.
APPEND w_header TO li_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = li_header.
endform.
I hope that it helps you.
Regards,
Venkat.O
w_fieldcat-fieldname = 'ENAME'.
w_fieldcat-tabname = 'I_PA0001'.
w_fieldcat-seltext_m = 'Employee Name'.
append w_fieldcat to i_fieldcat.
clear w_fieldcat.
04-02-2008 3:32 PM
Hi,
Supply a different Subroutine to the ALV FM's....in the parameter
I_CALLBACK_TOP_OF_PAGE
Santhosh
04-02-2008 3:38 PM
Thanks for quick reply,
i am using that FM just it displays blank and some space is showing for that.
Regards,
04-02-2008 3:44 PM
I mean this
Primary ALV
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP_OF_PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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.
Second ALV
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP_OF_PAGE2' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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.
Form TOP_OF_PAGE.
use Fm REUSE_ALV_COMMENTARY_WRITE here
EndForm.
Form TOP_OF_PAGE2.
use Fm REUSE_ALV_COMMENTARY_WRITE here
EndForm.
This will work.
santhosh