‎2006 Apr 21 11:50 AM
Hi Group,
When I am crating ALV header I am getting header as
ABAP report Templet
date: 21.04.2006 runtime:11.50
I need ouput like
date :21.04.2006 ABAP report Templet(in bold) time:11.50 .
Also the how to show the logo in left hand side.
I am using the following code.Please suggest.
REPORT ZTEMPLET .
TABLES: MARAV.
type-pools: slis. "ALV Declarations
*Data Declaration
*----
TYPES: BEGIN OF t_marav,
matnr like marav-matnr,
maktx like marav-maktx,
matkl like marav-matkl,
ntgew like marav-ntgew,
gewei like marav-gewei,
END OF t_marav.
DATA: it_marav TYPE STANDARD TABLE OF t_marav INITIAL SIZE 0,
wa_marav TYPE t_marav.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
************************************************************************
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
&----
*& Form BUILD_FIELDCATALOG
&----
Build Fieldcatalog for ALV Report
----
form build_fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material number'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MAKTX'.
fieldcatalog-seltext_m = 'Material Des'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATKL'.
fieldcatalog-seltext_m = 'Material group '.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NTGEW'.
fieldcatalog-seltext_m = 'Net weight'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GEWEI'.
fieldcatalog-seltext_m = 'weight unit '.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
&----
*& Form BUILD_LAYOUT
&----
Build layout for ALV grid report
----
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
&----
*& Form DISPLAY_ALV_REPORT
&----
Display report using ALV grid
----
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_marav
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.
endform. " DISPLAY_ALV_REPORT
&----
*& Form DATA_RETRIEVAL
&----
Retrieve data form EKPO table and populate itab it_ekko
----
form data_retrieval.
select matnr maktx matkl ntgew gewei
up to 10 rows
from marav
into table it_marav.
endform. " DATA_RETRIEVAL
----
Form TOP-OF-PAGE *
----
ALV Report Header *
----
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c,
v_data(15) type c,
v_time(15) type c,
v_title(20) type c.
data: v_space(3) value ' '.
Title
wa_header-typ = 'H'.
wa_header-info = sy-title.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Report Des:'.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO v_data.
CONCATENATE sy-uzeit(2) '.'
sy-uzeit+2(2) '.'
INTO v_time.
v_title = sy-title.
Concatenate 'Date :' v_data 'Run Time :' v_time into wa_header-info
separated by v_space. "todays date
append wa_header to t_header.
wa_header-typ = 'S'.
wa_header-key = 'Run Time '.
CONCATENATE sy-uzeit(2) '.'
sy-uzeit+2(2) '.'
sy-uzeit+4(2) INTO wa_header-info.
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_marav lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header
i_logo = 'LOGO'.
endform.
----
FORM USER_COMMAND *
----
--> R_UCOMM *
--> RS_SELFIELD *
----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
&----
*& Form BUILD_EVENTS
&----
Build events table
----
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
&----
*& Form BUILD_PRINT_PARAMS
&----
Setup print parameters
----
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
&----
*& Form END_OF_PAGE
&----
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/'User :' , sy-uname.
write:/40 'Page:', sy-pagno .
endform.
&----
*& Form END_OF_LIST
&----
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c,
v_time(10) type c.
skip.
CONCATENATE sy-uzeit(2) '.'
sy-uzeit+2(2) '.'
sy-uzeit+4(2) INTO v_time.
write:/'User :' , sy-uname, 30 'CSTP' ,50 'Page:', sy-pagno .
‎2006 Apr 21 12:59 PM
Hello,
it is not possible as per your requirment. You can get all things in Small letter by
concatenate
'date :21.04.2006' 'ABAP report Templet' 'time:11.50' and pass it to the header table .
Regards,
Naimesh