ZDEMO_FALV10 - Color Settings
"! This is demo for FALV full screen with color settings
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv10.
types: begin of t_sflight.
include type sflight.
types: cell_color type lvc_t_scol,
row_color type char4,
end of t_sflight.
data: sflight type standard table of t_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_FALV10'.
"Changing some of field catalog settings for column colors
falv->column( 'SEATSMAX' )->set_color( 'C700' ).
"setting of color fields -> this must be done before calling
"set_row_colors or set_cell_color
falv->layout->set_ctab_fname( 'CELL_COLOR' ).
falv->layout->set_info_fname( 'ROW_COLOR' ).
"change some row colors
do 10 times.
falv->set_row_color(
exporting
iv_color = 'C300'
iv_row = 2 * sy-index
).
enddo.
"change some cell colors.
do 10 times.
falv->set_cell_color(
exporting
iv_fieldname = 'PLANETYPE'
iv_color = value #( col = 5 int = 0 inv = 0 )
iv_row = 3 * sy-index
).
enddo.
"Display full screen grid
falv->display( ).
ZDEMO_FALV09 - Cell settings
"! 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_FALV08 - Mass replace function
"! This is demo for FALV with mass replace function
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv08.
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_FALV08'.
"set whole grid editable
falv->layout->set_edit( abap_true ).
falv->set_editable( iv_modify = abap_true ).
"show default grid toolbar
falv->layout->set_no_toolbar( abap_false ).
"Add mass replace function to grid toolbar (can be also added to GUI STATUS as well )
falv->add_button(
exporting
iv_function = falv->fc_mass_replace
iv_icon = icon_replace
* iv_quickinfo =
* iv_butn_type =
* iv_disabled =
iv_text = 'Mass replace'
* iv_checked =
).
"Display full screen grid
falv->display( ).
ZDEMO_FALV07 - Columns (field catalog) settings
"! This is demo for FALV full screen with fieldcatalog update
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv07.
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_FALV07'.
"Changing some of field catalog settings
falv->column( 'SEATSMAX' )->set_hotspot( abap_true ).
falv->column( 'SEATSMAX' )->set_color( 'C700' ).
falv->column( 'PLANETYPE' )->set_color( 'C300' ).
falv->column( 'PLANETYPE' )->set_no_merging( abap_true ).
falv->column( 'PAYMENTSUM' )->set_no_zero( abap_true ).
"or
data(price) = falv->column( 'PRICE' ).
price->set_no_out( abap_true ).
data(occup) = falv->column( 'SEATSOCC' ).
occup->set_no_zero( abap_true ).
occup->set_no_merging( abap_true ).
"Display full screen grid
falv->display( ).
ZDEMO_FALV06 - Grid Layout settings + "Mark" field
"! This is demo for FALV full screen with layout changes
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv06.
types: begin of t_sflight,
mark type bcselect.
include type sflight.
types: end of t_sflight.
data: sflight type standard table of t_sflight.
parameter: p_usemar as checkbox.
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_FALV06'.
"All layout settings have set method in layout object of FALV
"it can be udated before output or during runtime of program
falv->layout->set_zebra( abap_true ).
falv->layout->set_no_merging( abap_true ).
"additionally there is a attribute mark field which when is set
"then fcat for it is changed so it's checkbox field and
"when you'll use standard select all/deselect all functions then
"it will check/uncheck checkbox instead of selecting/deselecting rows
if p_usemar eq abap_true.
falv->set_mark_field( 'MARK' ).
endif.
"user Layout option save changed to user-specific only
falv->layout_save = 'U'.
"Display full screen grid
falv->display( ).
ZDEMO_FALV05 - Adding/Removing/Disabling grid toolbar
"! This is demo for FALV grid button adding, deleting, enabling, disabling
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv05.
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_user_command redefinition.
private section.
endclass.
class lcl_test implementation.
method evt_user_command.
case e_ucomm.
when zcl_falv_dynamic_status=>b_01.
me->enable_button( me->mc_fc_print_back ).
when zcl_falv_dynamic_status=>b_02.
me->disable_button( me->mc_fc_print_back ).
me->add_button(
exporting
iv_function = zcl_falv_dynamic_status=>b_03
iv_icon = icon_alarm
).
when zcl_falv_dynamic_status=>b_03.
me->delete_button( zcl_falv_dynamic_status=>b_03 ).
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_FALV05'.
"Set Gui status to fully dynamic (no standard buttons of ALV Grid)
falv->gui_status->fully_dynamic = abap_true.
"Add button into GUI status at for function F01 (in partial dynamic GUI Status we can have up to 19 buttons)
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_01
iv_text = 'Enable Print'
iv_icon = icon_activate
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
endif.
"Add button into GUI status at for function F02
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_02
iv_text = 'Disable Print'
iv_icon = icon_active_inactive
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
endif.
"In default when we use full screen FALV, Grid toolbar is switched off, we must turn it on )
falv->layout->set_no_toolbar( abap_false ).
"we Add buttons to ALV grid toolbar, I'll use same function like in GUI status
falv->add_button(
exporting
iv_function = zcl_falv_dynamic_status=>b_01
iv_icon = icon_activate
* iv_quickinfo =
* iv_butn_type =
* iv_disabled =
iv_text = 'Enable Print'
* iv_checked =
).
"we Add buttons to ALV grid toolbar, I'll use same function like in GUI status
falv->add_button(
exporting
iv_function = zcl_falv_dynamic_status=>b_02
iv_icon = icon_active_inactive
* iv_quickinfo =
* iv_butn_type =
* iv_disabled =
iv_text = 'Disable Print'
* iv_checked =
).
"remove button "Details" & "Info" from standard Grid functions
falv->delete_button( falv->mc_fc_detail ).
falv->delete_button( falv->mc_fc_info ).
"Display full screen grid
falv->display( ).
ZDEMO_FALV04 - Full Screen with fully dynamic GUI Status
"! This is demo for FALV full screen with fully dynamic GUI STATUS
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv04.
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_user_command redefinition.
private section.
endclass.
class lcl_test implementation.
method evt_user_command.
case e_ucomm.
when zcl_falv_dynamic_status=>b_01.
call function 'POPUP_DISPLAY_MESSAGE'
exporting
titel = 'Popup' " Title
msgid = '00'
msgty = 'S'
msgno = '001'
msgv1 = 'Button 1 clicked'.
when zcl_falv_dynamic_status=>b_02.
call function 'POPUP_DISPLAY_MESSAGE'
exporting
titel = 'Popup' " Title
msgid = '00'
msgty = 'S'
msgno = '001'
msgv1 = 'Button 2 clicked'.
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_FALV04'.
"Set Gui status to fully dynamic (no standard buttons of ALV Grid)
falv->gui_status->fully_dynamic = abap_true.
"Add button into GUI status at for function F01 (in partial dynamic GUI Status we can have up to 19 buttons)
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_01
iv_text = 'POPUP 01'
iv_icon = icon_abc
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
"Add button into GUI status at for function F02
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_02
iv_text = 'POPUP 02'
iv_icon = icon_address
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
"Display full screen grid
falv->display( ).
ZDEMO_FALV03 - Full Screen with GUI Status Partly Dynamic
"! This is demo for FALV full screen with partly dynamic GUI STATUS
"! done by Lukasz Pegiel for http://abapblog.com
report zdemo_falv03.
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_user_command redefinition.
private section.
endclass.
class lcl_test implementation.
method evt_user_command.
case e_ucomm.
when zcl_falv_dynamic_status=>b_01.
call function 'POPUP_DISPLAY_MESSAGE'
exporting
titel = 'Popup' " Title
msgid = '00'
msgty = 'S'
msgno = '001'
msgv1 = 'Button 1 clicked'.
when zcl_falv_dynamic_status=>b_02.
call function 'POPUP_DISPLAY_MESSAGE'
exporting
titel = 'Popup' " Title
msgid = '00'
msgty = 'S'
msgno = '001'
msgv1 = 'Button 2 clicked'.
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_FALV03'.
"Add button into GUI status at for function F01 (in partial dynamic GUI Status we can have up to 19 buttons)
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_01
iv_text = 'POPUP 01'
iv_icon = icon_abc
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
endif.
"Add button into GUI status at for function F02
falv->gui_status->add_button(
exporting
iv_button = zcl_falv_dynamic_status=>b_02
iv_text = 'POPUP 02'
iv_icon = icon_address
* iv_qinfo =
* iv_allowed = ABAP_TRUE
exceptions
button_already_filled = 1
button_does_not_exists = 2
icon_and_text_empty = 3
others = 4
).
if sy-subrc <> 0.
endif.
"Display full screen grid
falv->display( ).