*$*$*.....CODE_ADD_1 - Begin..................................1..*$*$*
*
* In this section we will define the private methods which can
* be implemented to set the properties of the ALV and can be
* called in the
*
PRIVATE SECTION.
* Default Pf Status
METHODS:
set_pf_status
CHANGING
co_alv TYPE REF TO cl_salv_table.
* Set Top of page
METHODS:
set_top_of_page
CHANGING
co_alv TYPE REF TO cl_salv_table.
*
* Set End of page
METHODS:
set_end_of_page
CHANGING
co_alv TYPE REF TO cl_salv_table.
*
*$*$*.....CODE_ADD_1 - End....................................1..*$*$*
*
*$*$*.....CODE_ADD_2 - Begin..................................2..*$*$*
*
* In this area we will call the methods which will set the
* different properties to the ALV
*
* Setting up the default PF status
CALL METHOD set_pf_status
CHANGING
co_alv = o_alv.
*
* Calling the top of page method
CALL METHOD me->set_top_of_page
CHANGING
co_alv = o_alv.
*
* Calling the End of Page method
CALL METHOD me->set_end_of_page
CHANGING
co_alv = o_alv.
*
*$*$*.....CODE_ADD_2 - End....................................2..*$*$*
*
*$*$*.....CODE_ADD_3 - Begin..................................3..*$*$*
*
* In this area we will implement the methods which are defined in
* the class definition
*
METHOD set_pf_status.
*
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
* Default Functions
lo_functions = co_alv->get_functions( ).
lo_functions->set_default( abap_true ).
*
ENDMETHOD. "set_pf_status
*
METHOD set_top_of_page.
*
DATA: lo_header TYPE REF TO cl_salv_form_layout_grid,
lo_h_label TYPE REF TO cl_salv_form_label,
lo_h_flow TYPE REF TO cl_salv_form_layout_flow.
*
* header object
CREATE OBJECT lo_header.
*
* To create a Lable or Flow we have to specify the target
* row and column number where we need to set up the output
* text.
*
* information in Bold
lo_h_label = lo_header->create_label( row = 1 column = 1 ).
lo_h_label->set_text( 'Header in Bold' ).
*
* information in tabular format
lo_h_flow = lo_header->create_flow( row = 2 column = 1 ).
lo_h_flow->create_text( text = 'This is text of flow' ).
*
lo_h_flow = lo_header->create_flow( row = 3 column = 1 ).
lo_h_flow->create_text( text = 'Number of Records in the output' ).
*
lo_h_flow = lo_header->create_flow( row = 3 column = 2 ).
lo_h_flow->create_text( text = 20 ).
*
* set the top of list using the header for Online.
co_alv->set_top_of_list( lo_header ).
*
* set the top of list using the header for Print.
co_alv->set_top_of_list_print( lo_header ).
*
ENDMETHOD. "set_top_of_page
*
METHOD set_end_of_page.
*
DATA: lo_footer TYPE REF TO cl_salv_form_layout_grid,
lo_f_label TYPE REF TO cl_salv_form_label,
lo_f_flow TYPE REF TO cl_salv_form_layout_flow.
*
* footer object
CREATE OBJECT lo_footer.
*
* information in bold
lo_f_label = lo_footer->create_label( row = 1 column = 1 ).
lo_f_label->set_text( 'Footer .. here it goes' ).
*
* tabular information
lo_f_flow = lo_footer->create_flow( row = 2 column = 1 ).
lo_f_flow->create_text( text = 'This is text of flow in footer' ).
*
lo_f_flow = lo_footer->create_flow( row = 3 column = 1 ).
lo_f_flow->create_text( text = 'Footer number' ).
*
lo_f_flow = lo_footer->create_flow( row = 3 column = 2 ).
lo_f_flow->create_text( text = 1 ).
*
* Online footer
co_alv->set_end_of_list( lo_footer ).
*
* Footer in print
co_alv->set_end_of_list_print( lo_footer ).
*
ENDMETHOD. "set_end_of_page
*
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin