09-11-2014 7:04 PM
Working on report, requirement to display page number on every page when we working ALV factory model.
I will be using below code, still I won't see page number.
DATA: lcl_footer TYPE REF TO cl_salv_form_header_info,
lv_pagno TYPE n.
CLEAR : lv_text, lv_pagno.
lv_pagno = sy-pagno.
CONCATENATE 'End of page'(030) ':' lv_pagno INTO lv_text.
CREATE OBJECT lcl_footer
EXPORTING
text = lv_text
tooltip = lv_text.
gr_table->set_end_of_list( lcl_footer ). "set end of list
gr_table->set_end_of_list_print( lcl_footer ). "set end of list
instead of printing page number, it always printing 0.
I wanted to display page number for each page when I run in back ground.
Note : I am using factory model.
Appreciate your quick help.
09-11-2014 7:12 PM
09-11-2014 7:27 PM
i have placed code like below,
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_rawi.
CATCH cx_salv_msg . "#EC NO_HANDLER
ENDTRY.
* Ready to Display
PERFORM f_top_end_function.
FORM f_top_end_function .
** Declarations for ALV Functions
DATA : gr_functions TYPE REF TO cl_salv_functions_list.
* Top-Of-page and end-of-list variable declaration
DATA : lr_header TYPE REF TO cl_salv_form_element,
lr_grid_layout TYPE REF TO cl_salv_form_layout_grid,
lr_label TYPE REF TO cl_salv_form_label,
lr_text TYPE REF TO cl_salv_form_text,
lv_text TYPE string.
* Get functions details
gr_functions = gr_table->get_functions( ).
** Activate All Buttons in Tool Bar
gr_functions->set_all( if_salv_c_bool_sap=>true ).
******* Layout Settings *******
CLEAR : gr_layout, gr_layout_key.
MOVE sy-repid TO gr_layout_key-report. "Set Report ID as Layout Key"
gr_layout = gr_table->get_layout( ). "Get Layout of Table"
gr_layout->set_key( gr_layout_key ). "Set Report Id to Layout"
gr_layout->set_save_restriction(
if_salv_c_layout=>restrict_none ). "No Restriction to Save Layout"
gr_layout->set_default( if_salv_c_bool_sap=>true ). "Set Default Variant"
* Create Object
CREATE OBJECT lr_grid_layout.
* Decide Movement type
IF r1 = gc_x.
lv_text = 'Raw Material IN'(004).
ELSEIF r2 = gc_x.
lv_text = 'Raw Material OUT'(005).
ELSEIF r3 = gc_x.
lv_text = 'PPC IN'(006).
ELSEIF r4 = gc_x.
lv_text = 'PPC OUT'(007).
ELSEIF r5 = gc_x.
lv_text = 'Finished IN'(008).
ELSEIF r6 = gc_x.
lv_text = 'Finished OUT'(009).
ELSEIF r7 = gc_x.
lv_text = 'Usage Decision Report'(010).
ENDIF.
lr_grid_layout->create_header_information( "create header for gird
row = 1
column = 3
text = lv_text
tooltip = lv_text ).
lr_grid_layout->add_row( ). "add row
** add label in grid **
lr_label = lr_grid_layout->create_label( row = 2
column = 1
text = 'Report'(020) ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 2
column = 3
text = sy-repid ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
** Add Label in Grid **
lr_label = lr_grid_layout->create_label( row = 3
column = 1
text = 'Tcode'(021) ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 3
column = 3
text = sy-tcode ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
** Add Label in Grid **
lr_label = lr_grid_layout->create_label( row = 4
column = 1
text = 'Date'(022) ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 4
column = 3
text = sy-datum ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
** add label in grid **
lr_label = lr_grid_layout->create_label( row = 5
column = 1
text = 'Time'(023) ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 5
column = 3
text = sy-uzeit ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
*** add label in grid **
lr_label = lr_grid_layout->create_label( row = 7
column = 1
text = '' ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 7
column = 3
text = 'Confidential Property of Eli Lilly and Company'(024) ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 8
column = 3
text = 'This ALV Grid Report is under cGMP validation Requirment'(025) ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
** add label in grid **
lr_label = lr_grid_layout->create_label( row = 9
column = 1
text = 'Excuted by User'(026) ).
** Add Text in The Grid **
lr_text = lr_grid_layout->create_text( row = 9
column = 3
text = sy-uname ).
** Set Label and Text Link **
lr_label->set_label_for( lr_text ).
lr_header = lr_grid_layout.
CALL METHOD gr_table->set_top_of_list "set top of list
EXPORTING
value = lr_header.
***end of list
DATA: lcl_footer TYPE REF TO cl_salv_form_header_info,
lv_pagno TYPE n.
CLEAR : lv_text, lv_pagno.
lv_pagno = sy-pagno.
CONCATENATE 'End of page'(030) ':' lv_pagno INTO lv_text.
CREATE OBJECT lcl_footer
EXPORTING
text = lv_text
tooltip = lv_text.
gr_table->set_end_of_list( lcl_footer ). "set end of list
gr_table->set_end_of_list_print( lcl_footer ). "set end of list
gr_table->display( ). "display ALV
ENDFORM. " F_TOP_END_FUNCTION
09-11-2014 7:28 PM
Top-of-page displayed well, but I don't see page number, I end-of-page triggered end of report and not for end of page again. I am not sure whether I am using right method, if you guys have sample code please place me here