"! This is demo for FALV with cell settings
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv09.
types: begin of t_sflight.
include type sflight.
types: styles type lvc_t_styl,
end of t_sflight.
data: sflight type standard table of t_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'.
me->set_cell_disabled(
exporting
iv_fieldname = e_column_id-fieldname
iv_row = es_row_no-row_id
).
me->set_cell_button(
exporting
iv_fieldname = 'PRICE'
iv_row = es_row_no-row_id
).
me->set_cell_hotspot(
exporting
iv_fieldname = 'CARRID'
iv_row = es_row_no-row_id
).
me->soft_refresh( ).
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 title variable
falv->title_v1 = 'ZDEMO_FALV09'.
"set whole grid editable
falv->layout->set_edit( abap_true ).
falv->set_editable( iv_modify = abap_true ).
"Set style column name
falv->layout->set_stylefname( 'STYLES' ).
falv->column( 'SEATSMAX' )->set_hotspot( abap_true ).
"Display full screen grid
falv->display( ).
ZDEMO_FALV09 - Cell settings
The latest version of each part of FALV can be found on github repository https://github.com/fidley/falv which you can use in abapGit for easier up to date handling.
Cell settings are possible if you have table lvc_t_styl in output table structure. If you want to use FALV way of handling cell settings then you need to firstly set stylefname attribute of layout so then you can use set_cell_xxxx methods. In following example, cell settings are set at hotspot click.
Video with demo results