How To Add Standard And Custom Toolbar On SALV Output?
One common problem with the SALV (Simple ALV) is that, by default, the generated output lacks a toolbar. This limitation can make the report less interactive and reduce its functionality, as users cannot easily perform actions like sorting, filtering, or exporting directly from the interface.
Fortunately, the SALV framework allows developers to add a toolbar manually and even extend it with your own custom function buttons in that toolbar.
In this tutorial, we’ll address this problem and guide you through the steps to enable and customize the toolbar for SALV output.
Tutorial Objectives |
1. Display standard SALV toolbar using SALV’s built-in method. |
2. Create custom toolbar and add custom buttons. |
Prerequisites |
1. SAP System Access: SAP GUI, ECC. |
2. Authorization: Developer role, TCODE: SE38, SE41. |
How To Display Toolbar on SALV?
To demonstrate the missing SALV toolbar, please copy the source code below. Save and Activate.
report z_salv_toolbar.
tables: scarr.
select-options: s_carrid for scarr-carrid.
class cl_salv definition.
public section.
data: ob_salv type ref to cl_salv_table.
data: it_data type table of scarr.
methods: get_data,
display_data.
endclass.
start-of-selection.
data(o_salv) = new cl_salv( ).
o_salv->get_data( ).
o_salv->display_data( ).
class cl_salv implementation.
method get_data.
select * into table it_data
from scarr.
endmethod.
method display_data.
cl_salv_table=>factory(
importing
r_salv_table = ob_salv " Basis Class Simple ALV Tables
changing
t_table = it_data
).
"display SALV
ob_salv->display( ).
endmethod.
endclass.
Run the report and here’s the SALV output.

As mentioned earlier, the toolbar is missing from the default SALV output!
So next, we’ll explore two methods to add a toolbar to the SALV output. The first one is adding the standard SALV toolbar and the second one is adding a custom toolbar. This enhancement will make the ALV report more interactive and provide a functional user interface, allowing users to perform additional actions directly from the toolbar.
Now let’s go through these methods one by one.
1. Display The Standard Toolbar Using CL_SALV_FUNCTIONS
As you can see, the ALV layout initially lacks a functions toolbar. To enable it, you need to work with an additional object, CL_SALV_FUNCTIONS. Therefore, declare a separate data object variable for this purpose in the CL_SALV definition class.

After that call the GET_FUNCTIONS before the OB_SALV->DISPLAY( ) and display all functions using the SET_ALL method.

After implementing the additional code, the toolbar will now appear in the ALV layout. This toolbar will include the standard functionality as shown below.

2. Display Custom SALV Toolbar
While it provides standard toolbar functionalities like sorting, filtering, and exporting by default, there are situations where you may need to extend the toolbar with custom buttons for specific actions enabling a more interactive and dynamic user experience.
So in this second method of displaying toolbar, we will be copying a standard toolbar and add our custom button onto that toolbar by following these steps.

Execute TCODE: SE41.
Enter the program name: SALV_DEMO_TABLE_FUNCTIONS and Click the Copy Status button.
Next, a Copy Status dialog box will appear, where you can specify the name of the STATUS to be copied, along with the destination program and the new STATUS name.

Step 1. Enter the status name: SALV_STANDARD
Step 2. Enter your custom program name (Z_SALV_TOOLBAR) and the status name (you can use the same name)
Step 3. Click the Copy Button

Step 4. Edit the newly copied Status bar. Click the Change button.

Step 5. Add a new button here.

Step 6. Save and Activate
Now go back to your ABAP program, remark the O_FUNCTIONS code and call the new copied STATUS by using the SET_SCREEN_STATUS method as shown below.

Step 7. Define a new method to handle the new function button click event .

Don’t forget to implement the method.

Next, you need to assign the event handler to your SALV table.

Check out this result!
