TOP-OF-PAGE & END-OF-PAGE Using CL_SALV_TABLE


REPORT zsalv_table_diaplay.

CLASS sales_order_disp DEFINITION.
PUBLIC SECTION.
DATA : o_salv TYPE REF TO cl_salv_table.
METHODS : build_salesorder,
disp_salesorder.
PRIVATE SECTION.
DATA : lt_vbak TYPE TABLE OF vbak.
METHODS : build_top_of_page CHANGING obj_salv TYPE REF TO cl_salv_table,
build_end_of_page CHANGING obj_salv TYPE REF TO cl_salv_table.

ENDCLASS.

CLASS sales_order_disp IMPLEMENTATION.
METHOD build_salesorder.
SELECT FROM vbak INTO TABLE lt_vbak UP TO 10 ROWS.
ENDMETHOD.

METHOD disp_salesorder.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table   = o_salv    ” Basis Class Simple ALV Tables
CHANGING
t_table        = lt_vbak
).
CATCH cx_salv_msg.
ENDTRY.
me->build_top_of_page(
CHANGING
obj_salv = o_salv ).

me->build_end_of_page(
CHANGING
obj_salv = o_salv ).

o_salv->display( ).
ENDMETHOD.

METHOD build_top_of_page.
DATA : o_top TYPE REF TO cl_salv_form_layout_grid,
o_label  TYPE REF TO cl_salv_form_label,
o_flow   TYPE REF TO cl_salv_form_layout_flow.
CREATE OBJECT o_top.
o_top->create_label(
EXPORTING
row         =  1   ” Natural Number
column      =  1   ” Natural Number
RECEIVING
r_value     =  o_label ).
o_label->set_text( value ‘Sales Order Details’ ).

o_top->create_flow(
EXPORTING
row     = 2    ” Natural Number
column  =  1   ” Natural Number
RECEIVING
r_value = o_flow ).
o_flow->create_text(
EXPORTING
text    ‘For the Month of Dec-2013’ ).

obj_salv->set_top_of_list( value =  o_top ).
ENDMETHOD.

METHOD build_end_of_page.
DATA : o_end TYPE REF TO cl_salv_form_layout_grid,
o_label  TYPE REF TO cl_salv_form_label,
o_flow   TYPE REF TO cl_salv_form_layout_flow.
CREATE OBJECT o_end.
o_end->create_label(
EXPORTING
row         =  1   ” Natural Number
column      =  1   ” Natural Number
RECEIVING
r_value     =  o_label ).
o_label->set_text( value ‘SAP Labs India.’ ).

o_end->create_flow(
EXPORTING
row     = 2    ” Natural Number
column  =  1   ” Natural Number
RECEIVING
r_value = o_flow ).
o_flow->create_text(
EXPORTING
text    ‘All rights reserved.’ ).

obj_salv->set_end_of_list( value = o_end ).
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
DATA: o_salesord TYPE REF TO sales_order_disp.
CREATE OBJECT o_salesord.
o_salesord->build_salesorder( ).
o_salesord->disp_salesorder( ).

 


 

3 comments

  1. Hi ,
    I have created top of page using same method, i have created a pf status also, while downloading the report ,iam not getting the top of page part ,Can you please help me

    Like

  2. Hello Josephin,

    what is displayed above is not TOP OF PAGE and END OF PAGE but TOP OF LIST and END OF LIST.

    If you have a printout with more than one page then you want to appear header lines at every TOP OF PAGE. TOP OF LIST apeears once on the first page.

    Kind regards

    Otto

    Like

Leave a Reply