Customising PF-STATUS – Adding custom icon/function in ALV Report

There is two ways to create an PF-STATUS:
1. Create a new PF-STATUS for our customise need
2. Copy status from a standard program and customise it.

1. Create a new PF-STATUS for a program

First, go to transaction Menu Painter (SE41). Enter the Program name and the Status name, then clickCreate button.


Enter the Short text and choose a Status Type (I demo a normal screen in this case).

From that window, we can add the customise icon for the application toolbar or adding function key for the standard toolbar. In this tutorial, I will add an function key ‘Export to PDF’ and adding function keyF3, F12 and F15 for standard toolbar.
Enter to custom function text ‘EPDF‘ and press Enter. From the pop-up window, choose Static Text Typeand press OK.


On the next pop-up window, enter details for the function text including Icon name (which is stand for the icon that will display in the application.


Assign the function to a Function Key (a shortcut key). Press Ok, then your customise function icon is created.



Next step, we assign some function key to standard toolbar.


Now Save and Activate it, then your PF-STATUS is ready to use.

2. Copy status from a standard program and customise it.

This way is not much different with creating a new PF-STATUS. Go to transaction Menu Painter (SE41). Enter the Program name and the Status name of the standard program, then click Copy Status button on the toolbar.

Enter our Program name and Status name that we want to create. Then press Copy.


An information, from here we can change the short texts of objects. Press Copy.


Now we have a new PF-STATUS created from a standard/existing one. From here we can add/remove custom/standard function to our program screen.



Adding PF-STATUS to ALV Report 

After create a custom screen for our program, we will call the PF-STATUS by following code:
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
     EXPORTING
     i_callback_program = sy-repid
     it_fieldcat = lt_fieldcat
     i_callback_pf_status_set = ‘FORM_MENU’ “GU status form
     TABLES
          t_outtab = lt_sflight.
*&———————————————————————*
*& Form FORM_MENU
*&———————————————————————*
* SET PF-STATUS to ALV Report creating Export PDF Button
*———————————————————————-*
FORM form_menu USING rt_extab TYPE slis_t_extab.
*SET PF STATUS to ALV
SET PF-STATUS ‘STANDARD_STATUS’.
ENDFORM. ” SET_PF_STATUS

RESULT

A new function icon Export to PDF added to the report.






Share this

Related Posts