SALV Table 2 : Adding Default PF STATUS in ALV

By | September 19, 2008 | SALV Table, SALV Tutorial, Tutorials | 74,075 | 2

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.
*
    DATAlo_functions TYPE REF TO cl_salv_functions_list.
*
    lo_functions co_alv->get_functions).
    lo_functions->set_defaultabap_true ).
*
  ENDMETHOD.                    "set_pf_status
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*

This will generate the output like:

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

2 Comments

  • Anonymous

    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?

  • Anonymous

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

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.