SALV Hierarchical Table 2 - Adding Default PF Status

Posted by Krishh Webworld | 11:45 AM | , , | 0 comments »

Today we will discuss how easy it is to add a Default PF status. In the previous post, we have discussed how to create a simple hierarchical table: SALV Hierarchical Table 1 - Simple table display. All discussion related to hierarchical (sequential) table can be found under Tutorials > SALV HS List.

To add a default PF status in the hierarchial (sequential) list created using the reference of the class CL_SALV_HIERSEQ_TABLE, we need to get the all the default PF status functions using the method GET_FUNCTIONS of the reference of the CL_SALV_HIERSEQ_TABLE.

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 Hierarchical Table 1 : Simple table display. Adding code to base program is like adding the code correction from the OSS Note.

UML diagram of the our test program would be like:
Code snippet to add the default pf status is as follows:


Code Snippet
  
*$*$*.....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 GENERATE_OUTPUT method
*
PRIVATE SECTION.
METHODS:
set_default_pf
CHANGING
co_hs_alv TYPE REF TO cl_salv_hierseq_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 me->set_default_pf
CHANGING
co_hs_alv = o_hs_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_default_pf.
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
lo_functions = co_hs_alv->get_functions( ).
lo_functions->set_all( abap_true ).
ENDMETHOD. "set_default_pf
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*


This code add-on will generate the default pf status like this:

0 comments

Archives

Subscribe Now: Feed Icon