We have discussed in post SALV Model 1: Normal ALV Table Display to generate an ALV using new the SALV Model. It is a true object oriented way to generate an ALV.
Today, we will see how to add standard PF Status (GUI Status) in this Standard ALV created using the class CL_SALV_TABLE. The object created with reference to CL_SALV_TABLE contains the method which can be helpful to add the PF-Status in the ALV.
Here is the code Snippet which provides the ADD-ON code. This ADD-ON code can be replaced with the relevent section from this code snippet in the base program. You can find the base program code snippet in the post SALV Model 1: Normal ALV Table Display . Adding code to base program is like adding the code correction from the OSS Note.
The new UML diagram of our application is like:
Code Snippet to add Default PF Status
*$*$*.....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.
METHODS:
set_pf_status
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
*
CALL METHOD set_pf_status
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.
*
lo_functions = co_alv->get_functions( ).
lo_functions->set_default( abap_true ).
*
ENDMETHOD. "set_pf_status
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*
Hi I have activated all functions..
functions->set_all(abap_true)
but the exel view does not work..
it appears normally, I press the button.. my excel loads but no data there… any ideas?
I think you have to adjust Visual Basic/macro security settings in Excel. Or what you see is an empty pivot table in Excel, so try to switch it to normal excel sheet somewhere in layout settings of ALV..