on 03-26-2008 6:18 AM
I am using the follwoing code but when I got print the page numbers are not displaying. I was copy the code from one of group message.
Please tell where I am making mistakes means why page numbers are not displaying at footer.
I want to print 30 rows on each page and display the page no. in footer of each page.
REPORT zift_test_alv.
----
Report Name: PS Report *
Created by: IALI *
*
----
Tables ( To support selection screen )
TABLES:
MSEG.
----
S E L E C T I O N S C R E E N *
----
*SELECT-OPTIONS: PostDate FOR BSIS-BUDAT.
SELECTION-SCREEN: Begin of block B01 WITH FRAME TITLE TITLE01.
SELECT-OPTIONS: so_plant FOR mseg-werks. " Plant
SELECTION-SCREEN: end of block B01.
----
D A T A D E C L A R A T I O N *
----
Types
types: begin of slis_print_alv1,
no_print_selinfos(1) type c, " display no selection infos
no_coverpage(1) type c, "
no_new_page(1) type c, "
reserve_lines type i, " lines reserved for end of page
no_print_listinfos(1) type c, " display no listinfos
no_change_print_params(1) type c, " don't change linesize
no_print_hierseq_item(1) type c, "don't expand item
print_ctrl type ALV_S_Pctl,
end of slis_print_alv1.
types: begin of slis_print_alv.
include type alv_s_prnt.
include type slis_print_alv1.
types: end of slis_print_alv.
types: begin of slis_alv_event,
name(30),
form(30),
end of slis_alv_event.
types: slis_t_event type slis_alv_event occurs 0.
TYPES: BEGIN OF ty_mseg,
WBS type mseg-PS_PSP_PNR,
MSEG_WERKS TYPE MSEG-WERKS, " Plant
ABLAD TYPE MSEG-ABLAD, " Unloading Point
WEMPF TYPE MSEG-WEMPF, " Goods Receiptent
MBLNR TYPE MSEG-MBLNR, " Material Do Number
end of ty_mseg.
Internal tables and work areas
DATA:
IT_MSEG type table of TY_MSEG,
GV_TITLE type LVC_TITLE.
DATA: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
r_alv_template type ref to ZCL_BT_ALV_TEMPLATE.
******************************************************************'
Data declarations for the ALV grid
******************************************************************'
DATA: r_grid TYPE REF TO cl_gui_alv_grid.
DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
wa_alv_fieldcat TYPE slis_fieldcat_alv,
alv_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
******************************************************************'
Initialization.
select single max( ddtext ) from dd02t into TITLE01 where tabname = 'MSEG'
and ddlanguage = sy-langu."#EC *
----
D A T A S E L E C T I O N *
----
START-OF-SELECTION.
SET COUNTRY 'PK'.
" Getting data from MSEG
SELECT APS_PSP_PNR AWERKS AABLAD AWEMPF A~MBLNR
FROM mseg AS A
INTO table it_mseg
WHERE a~werks in so_plant.
A~PS_PSP_PNR IN SO_WBS.
*BREAK-POINT.
----
A L V P R O C E S S I N G *
----
END-OF-SELECTION.
PERFORM alv_setup.
PERFORM display_alv.
FORM alv_setup.
CLEAR wa_alv_fieldcat.
REFRESH alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'WBS'.
wa_alv_fieldcat-seltext_s = 'WBS'.
wa_alv_fieldcat-seltext_m = 'WBS Element'.
wa_alv_fieldcat-seltext_l = 'WBS Element'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'ABLAD'.
wa_alv_fieldcat-seltext_s = 'Un Ld Pnt'.
wa_alv_fieldcat-seltext_m = 'Un Lding Pnt'.
wa_alv_fieldcat-seltext_l = 'Un Loading Point'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'MSEG_WERKS'.
wa_alv_fieldcat-seltext_s = 'Plant'.
wa_alv_fieldcat-seltext_m = 'Plant'.
wa_alv_fieldcat-seltext_l = 'Plant'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'WEMPF'.
wa_alv_fieldcat-seltext_s = 'Good Rec'.
wa_alv_fieldcat-seltext_m = 'Good Rec'.
wa_alv_fieldcat-seltext_l = 'Good Receipt'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
wa_alv_fieldcat-key = ''.
wa_alv_fieldcat-fieldname = 'MBLNR'.
wa_alv_fieldcat-seltext_s = 'Mat Doc'.
wa_alv_fieldcat-seltext_m = 'Mat Doc'.
wa_alv_fieldcat-seltext_l = 'Mat. Doc. No.'.
APPEND wa_alv_fieldcat TO alv_fieldcat.
ENDFORM. " alv_setup DMBTR
FORM display_alv.
gd_repid = sy-repid.
Configure layout of screen
alv_layout-colwidth_optimize = 'X'.
alv_layout-zebra = 'X'.
alv_layout-no_min_linesize = 'X'.
Now call display function
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP_OF_PAGE_SETUP' "Ref to form
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_grid_title = text-005
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
TABLES
t_outtab = IT_mseg
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.
perform build_events.
perform build_print_params.
ENDFORM. " display_alv
FORM top_of_page_setup.
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
wa_header-typ = 'H'.
wa_header-info = 'Test Report '.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. " top_of_page_setup
&----
*& 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:/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.
Regards
Iftikhar Ali
Islamabad
Hi
Copy the code from this link and make changes
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
then use sy-pagno to get the page number
regards
shiva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was copy the code from link http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm. but when I execute my program it give the following error that function "Z_YHEAD_PRINT" not exist. So what is this function and from where i can found it.
Regards
Iftikhar Ali
Islamabad.
Hi,
Try this one.
FORM end_of_page_setup.
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
wa_header-typ = 'H'.
concatenate 'Page No ' sy-pagno into wa_header-info separted by space.
APPEND wa_header TO t_header.
CLEAR wa_header.
endform.
Regards,
Ballack.
Reward Points if helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
just populate ur eventcat like this , may be this can help u
form zf_eventcat using p_it_eventcat type slis_t_event.
data l_eventcat type slis_alv_event.
clear l_eventcat.
*Get all the events.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_it_eventcat
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.
TOP-OF-PAGE FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_top_of_page.
if sy-subrc = 0.
move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
PF_STATUS_SET FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_pf_status_set.
if sy-subrc = 0.
move 'ZF_PF_STATUS_SET' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
USER_COMMAND FORM
clear l_eventcat.
read table p_it_eventcat into l_eventcat with key
name = slis_ev_user_command.
if sy-subrc = 0.
move 'ZF_USER_COMMAND' to l_eventcat-form.
modify p_it_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
endform. " zf_eventcat
reward if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
http://www.saptechnical.com/Tutorials/ALV/PageNumbers/Demo.htm
Refer to the above link, It will provide you some help..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was copy the code from http://www.saptechnical.com/Tutorials/ALV/PageNumbers/Demo.htm but it give the errors that some data objects are not declared in dictionary like i_sort.
So what can i do and how to declare these data objects.
Please give me a code sample where above example is implemented.
Regards
Iftikhar Ali
Islamabad.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.