ERPClimb logoERPClimb
ALV Reports
ABAP Developmentintermediate 11 min read

ALV Reports Part 8: Toolbar Buttons, PF-STATUS and User Commands

Preview · a free account unlocks the full lesson

Key takeaway

Add your own functions to an ALV: a copied PF-STATUS with i callback pf status set for REUSE ALV, the toolbar and user command events of CL GUI ALV GRID, reading selected rows, and refreshing the grid after an action.

In this lessonShow sections

Explanation

Part 6 covered reacting to clicks on individual cells. Now users need to select rows and press your own buttons — "Release," "Send e-mail," "Recalculate" — and this part covers adding those for both the classic function-module ALV and the object-oriented grid.

For REUSE_ALV, the approach is to copy status STANDARD_FULLSCREEN (program SAPLKKBL) into your program, add buttons, set it in the FORM named in i_callback_pf_status_set. Concretely, copy that status from program SAPLKKBL into your own report, give it a name such as ZSTANDARD, and it keeps every standard ALV function intact.

Add your own button to it — say, function code REFRESH or RELEASE, with its own icon and text. Pass i_callback_pf_status_set = 'SET_PF_STATUS', and inside a FORM set_pf_status USING rt_extab TYPE slis_t_extab. call SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab. Pass i_callback_user_command = 'USER_COMMAND' as well, so your function codes arrive in r_ucomm for handling.

Setting rs_selfield-refresh = 'X' inside that callback tells the ALV to refresh itself afterward. To let users select rows, either add a checkbox column, or use the layout's box_fieldname (in SLIS) pointing to a SEL field in your output table.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.