SALV Table 3 : Adding Custom PF STATUS in ALV

By | September 20, 2008 | SALV Table, SALV Tutorial, Tutorials | 47,573 | 2

We have seen in the previous posts of this Blog series about the new SALV model to Create ALV:
SALV Model 1: Normal ALV Table Display
SALV Model 2: Adding default PF STATUS in ALV

Sometimes we need to create our own PF Status (GUI Stauts) with more buttons which can provide the users more ways to interact with the ALV. To set our custom PF status we need to:

First create a PF status: We need to create a PF status with our own buttons as well as the ALV standard buttons. If we don’t add the ALV buttons than it would not provide the standard functions of ALVs. On the other hand it is very tedious to add all the ALV buttons in our PF status manually. So here is the easy way: We will copy the PF-Status using of any standard SALV_DEMO report using the transaction SE41: Menu Painter. After Copying the PF-Status we can add our own buttons.

Call Method of SALV to display PF: Now we will call this newly created PF status in our ALV using the method SET_SCREEN_STATUS of the reference of the class CL_SALV_TABLE.

Here is the code snippet to which provides the ADD-ON code to our Base program. The base program can be found in the SALV Model 1: Normal ALV Table Display .

UML diagram is same as the post SALV Model 2: Adding default PF STATUS in ALV .

*$*$*.....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.
*
*   Calling method to set the PF-Status
    co_alv->set_screen_status(
      pfstatus      =  'SALV_STANDARD'
      report        =  'SALV_DEMO_TABLE_SELECTIONS'
      set_functions co_alv->c_functions_all ).
*
  ENDMETHOD.                    "set_pf_status
*$*$*.....CODE_ADD_3 - End....................................3..*$*$*

For sake of simplicity, I have used the pfstaus SALV_STANDARD of the Report SALV_DEMO_TABLE_SELECTIONS.

This code will generate output like:

Limitation:
Till ECC 6 EhP3, SALV OM does not support to have the separator in the custom toolbar of the ALV Grid (ALV created using the container).

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{272 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 272 articles.

Load comments

2 Comments

  • Hi Naimish,
    I want to add one field in the standard report . What is the procedure.
    regards,
    Ram anjireddy

  • Marko

    Hello,
    Thank you for your great blog. Your tutorials are extremely useful! Especially the SALV series you wrote.
    I have a question regarding the application toolbar. I am using the GUI status “SALV_STANDARD” exactly as you in the tutorial. How is it possible that there is no icon for “select all” and “deselect all” in the toolbar? When I run the program “SALV_DEMO_TABLE_SELECTIONS” the are both there.
    What else do I need to change?
    Your response is greatly appreciated! Thank you very much in advance.

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.