ZDEMO_FALV02 - Full screen with redefinitions
"! This is demo for FALV with redefinition of hotspot event handler
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv02.
data: sflight type standard table of sflight.
class lcl_test definition inheriting from zcl_falv.
public section.
protected section.
"redefinition of event handler
methods evt_hotspot_click redefinition.
private section.
endclass.
class lcl_test implementation.
method evt_hotspot_click.
case e_column_id-fieldname.
when 'SEATSMAX'.
call function 'POPUP_DISPLAY_MESSAGE'
exporting
titel = 'Hotspot is working' " Title
msgid = '00'
msgty = 'I'
msgno = '001'
msgv1 = 'Yupi!'.
endcase.
endmethod.
endclass.
start-of-selection.
select * up to 100 rows
into corresponding fields of table @sflight
from sflight.
"creation of falv with local redefinition
data falv type ref to lcl_test.
falv ?= lcl_test=>create( exporting i_subclass = cl_abap_classdescr=>describe_by_name( p_name = 'LCL_TEST' )
changing ct_table = sflight ) .
"Add hotspot to column 'SEATSMAX'
falv->column( 'SEATSMAX' )->set_hotspot( abap_true ).
"Add title variable
falv->title_v1 = 'ZDEMO_FALV02'.
"Display full screen grid
falv->display( ).
ZDEMO_FALV01 - Standard full screen FALV
"! This is demo for FALV standard fast call
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv01.
data: sflight type standard table of sflight.
start-of-selection.
select * up to 100 rows
into corresponding fields of table @sflight
from sflight.
"FALV creation with only table passed
data(falv) = zcl_falv=>create( changing ct_table = sflight ).
"Add title variable
falv->title_v1 = 'ZDEMO_FALV01'.
"Display full screen grid
falv->display( ).
FALV (Fast ALV Grid)
- Why I've created FALV although SALV classes are provided by SAP?
I know SALV classes although I haven't used them often. The main reason was that they don't provide edit mode. So at the end I've always worked with cl_gui_alv_grid class so then whenever users decided that they need one of the field to be editable then I can do it in few seconds/minutes.
- But there is a way to make SALV editable!
Yes, I know the solutions of Naimesh Patel (found here) and Paul Hardy (in his ABAP to the Future book) and some other folks to make SALV editable. But In my own opinion, especially when you're at least on 7.40 with SP5 making SALV editable is not needed as you can fast create ALV Grid which does everything you want. To be clear the big advantage of SALV, to call grid output of table in two, three lines when you goes to the code you'll see it's nothing more than call of REUSE_ALV_GRID_DISPLAY... really old FM, which at the end use CL_GUI_ALV_GRID.
- Direct reasons
As I used CL_GUI_ALV_GRID so often then I came up with an idea to do some class which will make the creation faster, but I never had time to do it at work. You may know it, because of the time pressure you choose to create report/program/solution in the way you're doing from years ... and then comes another task....and another....
So I've decided to do it at home.... yeah I'm crazy. But at least some of you can also use it.
- Advantages
- Fast CL_GUI_ALV_GRID creation
- Replacement of REUSE_ALV_GRID_DISPLAY and REUSE_ALV_GRID_DISPLAY_LVC for a simple editable reports to omit screen creation
- All events are already handled and with redefinition of method I can faster use it
- Faster setting of layout and field catalog attributes
- Easy switch and copy between popup, full screen and container version
- Easy toolbar handling (in grid and in full screen/popup using Dynamic GUI STATUS & TITLE with ABAP code )
- One place to handle user commands of full screen/popup call -> event user_command
- Prerequisites
I've worked on this on 7.40 SP8 but this should work also on SP5 as well. Sorry for the users bellow that versions but I'm so used to use new syntax that I couldn't force myself to use old way of coding.
UPDATE: Thanks to Santi Moreno we have now 7.31 version, you can find it here as an attachment ZFALV_V1.1.0.zip. Also GitHub repository is now available here https://github.com/fidley/falv so if you'd like to join us, you're more than welcomed.
- Outcome
- Package ZFALV
- Classes
- Function Group
- ZFALV - screens, GUI STATUSES, TITLE, FMs for ZCL_FALV, local classes
- Demo Programs
- ZDEMO_FALV01 - FALV: Demo Simple Full Screen Call
- ZDEMO_FALV02 - FALV: Demo with Redefinitions
- ZDEMO_FALV03 - FALV: Demo Full Screen GUI Status Dynamic Partly
- ZDEMO_FALV04 - FALV: Demo Full Screen GUI Status Dynamic Fully
- ZDEMO_FALV05 - FALV: Demo Full Screen ALV Toolbar
- ZDEMO_FALV06 - FALV: Demo Full Screen Layout
- ZDEMO_FALV07 - FALV: Demo Full Screen Columns
- ZDEMO_FALV08 - FALV: Demo Mass Replace Function
- ZDEMO_FALV09 - FALV: Demo Cell Settings
- ZDEMO_FALV10 - FALV: Demo Colors
- ZDEMO_FALV11 - FALV: Demo Editable
- ZDEMO_FALV12 - FALV: Demo Error Log
- ZDEMO_FALV13 - FALV: Mix Demo + own screen and container usage
- ZDEMO_FALV14 - FALV: Popup calls
FALV (Fast ALV Grid) - First blood
- Fast CL_GUI_ALV_GRID creation
- Replacement of REUSE_ALV_GRID_DISPLAY and REUSE_ALV_GRID_DISPLAY_LVC for a simple editable reports to omit screen creation
- All events should be already handled and with redefinition of method I can faster use it
- Faster setting of layout and field catalog attributes
- Easy switch and copy between popup, full screen and container version
- Easy toolbar handling (in grid and in full screen/popup using Dynamic GUI STATUS & TITLE with ABAP code )
- One place to handle user commands of full screen/popup call -> event user_command