SALV Table 3 : Adding Custom PF STATUS in ALV

Posted by Krishh Webworld | 10:42 AM | , , | 0 comments »

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 Snippet to Add custom 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.
*
* 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:

0 comments

Archives

Subscribe Now: Feed Icon