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  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..*$*$*
 
 | 
This will generate the output like:
 
No comments:
Post a Comment