03-04-2008 9:51 AM
hi
in my report i am getting the output in the heading
Page No. 1
Total Pages. 19
Plant AD02
Plant name AoD Qwest Sterling II
Phys.Inv.Doc.Number 0100000000
Planned Count Date 05/31/2007
Created By BOWFSHFLSTOR
Report Run Date 03/04/2008
form top_of_page.
wa_header1-typ = 'S' .
wa_header1-key = text-009.
wa_header1-info = wa_header-pageno.
APPEND wa_header1 TO it_header1.
CLEAR wa_header1 .
wa_header1-typ = 'S' .
wa_header1-key = text-010.
wa_header1-info = wa_header-tpageno.
APPEND wa_header1 TO it_header1.
CLEAR wa_header1 .
here am doing it by passing the informations in it_header1
and then calling
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header1
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM. "top_of_page
Page No. 1
Total Pages. 19
now what i need is in the output header i need the page number and total pages in the right hand side of the top of page i.e just parallel to plant and plant name how can i do it
without calling any methods.
03-04-2008 9:53 AM
hi
check the following link
Sample ALV: Heading in ALV
With Compliments by: Ulhas Sonawane
report zus_alv_demo_grid .
tables: ekko.
type-pools: slis.
types: begin of t_ekko,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
statu type ekpo-statu,
aedat type ekpo-aedat,
matnr type ekpo-matnr,
menge type ekpo-menge,
meins type ekpo-meins,
netpr type ekpo-netpr,
peinh type ekpo-peinh,
line_color(4) type c, "Used to store row color
end of t_ekko.
data: it_ekko type standard table of t_ekko initial size 0,
wa_ekko type t_ekko.
*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.
Data declaration for EVENT and PRINT PARAMETER.
data: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
data declaration for sorting.
data : it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
data : i_list_comments type slis_t_listheader.
start-of-selection.
perform data_retrieval.
perform user_command.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform build_sortcat.
perform display_alv_report.
end-of-selection.
*TOP-OF-PAGE.
PERFORM top-of-page.
end-of-page.
*&----
-
*& Form build_fieldcatalog
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " build_fieldcatalog
*&----
-
*& Form build_layout
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for
*when double
"click(press f2)*
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " build_layout
*&----
-
*& Form data_retrieval
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr
peinh from ekpo into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " data_retrieval
*&----
-
*& Form display_alv_report
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
it_event = gt_events
is_print = gd_prntparams
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
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.
endif.
endform. " DISPLAY_ALV_REPORT
*&----
-
*& Form user_command
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
*&----
-
*& Form top-of-page
*&----
-
text
*----
-
--> p1 text
<-- p2 text
*----
-
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.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
concatenate sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) into wa_header-info."todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko 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 = 'GANESH_LOGO'.
endform. " top-of-page
*----
*
FORM user_command *
*----
*
........ *
*----
*
--> R_UCOMM *
--> RS_SELFIELD *
*----
*
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
when 'ULHAS'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
endcase.
endform.
*----
*
FORM set_pf_status *
*----
*
........ *
*----
*
--> RT_EXTAB *
*----
*
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ZNEWSTATUS'.
endform.
*&----
*
*& Form build_events
*&----
*
text
*----
*
--> p1 text
<-- p2 text
*----
*
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[]
EXCEPTIONS
LIST_TYPE_WRONG = 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.
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
*&----
*
text
*----
*
--> p1 text
<-- p2 text
*----
*
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:/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.
skip. write:/40 'Page:', sy-pagno .
endform.
*&----
*
*& Form build_sortcat
*&----
*
text
*----
*
--> p1 text
<-- p2 text
*----
*
form build_sortcat.
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
append wa_sort to it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
append wa_sort to it_sortcat.
endform. " build_sortcat
Fast Links:
Get help for your ABAP problems
Do you have a ABAP Question?
ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books
ABAP Tips
ABAP Forum for Discussion and Samples Program Codes for Abapers
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
All the site contents are Copyright © www.sap-img.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies. The site www.sap-img.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity. Information used on this site is at your own risk.
The content on this site may not be reproduced or redistributed without the express written permission of
www.sap-img.com or the content authors.
regards,
sreelatha gullapalli
03-04-2008 9:54 AM
hi here is the similar coding for ur requirement...
check this...
*----------------------------------------------------------------------*
FORM HEADER .
WRITE sy-datum MM/DD/YYYY TO today.
WRITE sy-uzeit TO curr_time.
WRITE sy-pagno TO page_no LEFT-JUSTIFIED.
REFRESH lt_list.
CLEAR lt_list.
****** REPORT PROGRAM NAME AND CLINT *****************
lt_list-typ = 'S'.
lt_list-key = space.
CONCATENATE 'Report...:' sy-repid '(' sy-sysid(3) sy-mandt ')'
INTO lt_list-info SEPARATED BY space.
APPEND lt_list TO lt_list.
****** USER NAME *************************************
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
CONCATENATE 'User.....:' sy-uname
INTO lt_list-info SEPARATED BY space.
APPEND lt_list TO lt_list.
****** DATE / TIME STAMP *****************************
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
CONCATENATE 'Date/Time:' today curr_time
INTO lt_list-info SEPARATED BY space.
APPEND lt_list TO lt_list.
****** PAGE NUMBER ***********************************
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
CONCATENATE 'Page.....:' page_no
INTO lt_list-info SEPARATED BY space.
APPEND lt_list TO lt_list.
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
CONCATENATE ' ' ' '
INTO lt_list-info SEPARATED BY space.
APPEND lt_list TO lt_list.
******* COMPANY NAME *********************************
* determine the starting position to center the company name
len = STRLEN( company_name ).
wa_num1 = 60 - len.
pos = wa_num1 / 2.
IF pos LT 1.
pos = 1.
ENDIF.
len = 60 - pos.
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
lt_list-info+pos(len) = company_name.
APPEND lt_list TO lt_list.
******* REPORT TITLE *********************************
* determine the starting position to center the report title
len = STRLEN( sy-title ).
wa_num1 = 60 - len.
pos = wa_num1 / 2.
IF pos LT 1.
pos = 1.
ENDIF.
len = 60 - pos.
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-key = space.
lt_list-info+pos(len) = sy-title.
APPEND lt_list TO lt_list.
****** SELECTION DATA LINE ***************************
WRITE s_date-low TO date_s.
WRITE s_date-high TO date_e.
CLEAR head_line.
CONCATENATE 'Period Selected--> ' date_s
'-' date_e
INTO head_line
SEPARATED BY space.
* determine starting position to center selection line
len = STRLEN( head_line ).
wa_num1 = 60 - len.
pos = wa_num1 / 2.
IF pos LT 1.
pos = 1.
ENDIF.
len = 60 - pos.
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-info+pos(len) = head_line.
APPEND lt_list.
CLEAR lt_list.
* determine starting position to center selection line
len = STRLEN( head_line ).
wa_num1 = 60 - len.
pos = wa_num1 / 2.
IF pos LT 1.
pos = 1.
ENDIF.
len = 60 - pos.
CLEAR lt_list.
lt_list-typ = 'S'.
lt_list-info+pos(len) = head_line.
APPEND lt_list.
CLEAR lt_list.
ENDFORM. " HEADER
<REMOVED BY MODERATOR>
venkat.
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 3:09 PM
03-04-2008 10:09 AM
Hi
In order to insert a report heading in to the ALV grid you need to perform the following steps:
1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM
2. Create 'top-of-page' FORM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
----
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.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko 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 = 'Z_LOGO'.
endform.
03-04-2008 10:22 AM
Hi all
am still unable to get it
can just please explain to get the 2 fields in the right hand side of my top of page along with their texts