SALV Hierarchical Table 2 – Adding Default PF Status

By | October 5, 2008 | SALV HS, SALV Tutorial, Tutorials | 11,028 | 0

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 Display .

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_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.
    DATAlo_functions TYPE REF TO cl_salv_functions_list.
    lo_functions co_hs_alv->get_functions).
    lo_functions->set_allabap_true ).
  ENDMETHOD.                    "set_default_pf
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*

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

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{274 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 274 articles.

Load comments

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.