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( ).

 


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s