Tags: FALV

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. 

ZCL_FALV is the main class of whole FALV. Everything starts here. Bellow you can find some description of main methods and attributes which are made in this class.

Methods: 

Attributes:
 

CREATE

This is a factory method which you need to use to create FALV object. 
 
 
I_PARENT If you don't want full screen or popup display of FALV then you need to pass a container for grid here
I_APPLOGPARENT Container for error log if you don't want it to be embedded
I_APPLOG_EMBEDDED If you pass 'X' here then grid will be displayed in split container with two rows, bottom row will be used to show error log if error will appear
I_POPUP If you want FALV to show popup with grid then you should pass 'X' to this parameter otherwise in case you don't pass parent container , grid will be shown in full screen
I_SUBCLASS If you create redefinition of ZCL_FALV to change event handling then you need to pass a class description to factory method
CT_TABLE Table to display, this one is mandatory
 
 

    class-methods create
      importing
        value(i_parent)          type ref to cl_gui_container optional
        value(i_applogparent)    type ref to cl_gui_container optional
        value(i_popup)           type abap_bool default abap_false
        value(i_applog_embeddedtype abap_bool default abap_false
        value(i_subclass)        type ref to cl_abap_typedescr optional
      changing
        !ct_table                type standard table
      returning
        value(rv_falv)           type ref to zcl_falv .
 

CREATE_BY_COPY

When you want to create a copy of an ALV instance with the same settings then you can use this method. It's also used in case of built-in popup screen as in case of popups grid and containers must be created directly in PBO event. Parameters have the same meaning like in method CREATE.

    methods create_by_copy
      importing
        value(i_parent)       type ref to cl_gui_container optional
        value(i_applogparenttype ref to cl_gui_container optional
        value(i_popup)        type abap_bool default abap_false
      returning
        value(rv_falv)        type ref to zcl_falv .

LVC_FCAT_FROM_ITAB

This is the method to create LVC field-catalog from internal table like in this article.

    class-methods lvc_fcat_from_itab
      importing
        !it_table      type standard table
      returning
        value(rt_fcattype lvc_t_fcat .

DISPLAY

Display method can be used in following places:

  • For Popup FALV - anywhere in the code
  • For Full Screen FALV - anywhere in the code
  • For FALV in own screen - in PBO event (whole creation of FALV should take place there)
     
IV_FORCE_GRID Optional - For internal use in case of popup and full screen FALV
IV_START_ROW Optional - for popup FALV, if not pass for popup FALV default values are used
IV_START_COLUMN Optional - for popup FALV, if not pass for popup FALV default values are used
IV_END_ROW Optional - for popup FALV, if not pass for popup FALV default values are used
IV_END_COLUMN Optional - for popup FALV, if not pass for popup FALV default values are used

 

    methods display
      importing
        value(iv_force_grid)   type abap_bool default space
        value(iv_start_row)    type optional
        value(iv_start_columntype optional
        value(iv_end_row)      type optional
        value(iv_end_column)   type optional .

EXCLUDE_FUNCTION

Can be used to fill EXCLUDE_FUNCTIONS table which is passed to SET_TABLE_FOR_FIRST_DISPLAY. As this works only before initial display, then alternatively DELETE_BUTTON function can be used which works also during display.

    methods exclude_function
      importing
        value(iv_ucommtype sy-ucomm .

 

COLUMN

Method to return column object (ZCL_FALV_COLUMN) from COLUMNS table. Can be used to change fieldcatalog in fast way. You need only to pass field name to use it.

    methods column
      importing
        value(iv_fieldnametype lvc_s_fcat-fieldname
      returning
        value(rv_column)    type ref to zcl_falv_column .

Example: falv->column( 'CARRID' )->set_scrtext_l( 'New name' ).

 

SOFT_REFRESH

Method to refresh the grid without passing parameters for soft and stable refreshing.

  method soft_refresh.

 

SET_MARK_FIELD

Method to set which field should be treated as "Mark field" means a checkbox which you select lines. Demo of the mark field can be found in ZDEMO_FALV06.

    methods set_mark_field
      importing
        value(iv_fieldnametype lvc_s_fcat-fieldname .

SET_EDITABLE

Set's grid is ready for input and registers edit event, in default enter, if you pass 'X' to IV_MODIFY then modify event.

    methods set_editable importing value(iv_modifytype abap_bool default abap_false.

 

SET_READONLY

This method switch to read only mode.

    methods set_readonly.

 

ADD_BUTTON

This methods allows to add button to grid toolbar. Can be use before or after first output. The demo of usage can be found in ZDEMO_FALV05

IV_FUNCTION User command
IV_ICON Icon for button, for examle ICON_ABC
IV_QUICKINFO Tooltip for button
IV_BUTN_TYPE Button type, you can use predefined constants BUTTON_xxx
IV_DISABLED Should the button be disabled 
IV_TEXT Text for button
IV_CHECKED If button type is checkbox then you can mark it defaulty as checked here

 

    methods add_button importing value(iv_function)  type ui_func
                                 value(iv_icon)      type icon_d optional
                                 value(iv_quickinfotype iconquick optional
                                 value(iv_butn_typetype tb_btype optional
                                 value(iv_disabled)  type abap_bool optional
                                 value(iv_text)      type text40 optional
                                 value(iv_checked)   type abap_bool optional.

 

DISABLE_BUTTON

This methods allows to disable (greys out) button which appears on grid toolbar. You need to pass only user command name to it. Can be use before or after first output. The demo of usage can be found in ZDEMO_FALV05.

    methods disable_button importing value(iv_functiontype ui_func.

 

ENABLE_BUTTON

Enables button which is disabled at the moment in grid toolbar. You need to pass only user command name to it. Can be use before or after first output. The demo of usage can be found in ZDEMO_FALV05.

methods enable_button importing value(iv_functiontype ui_func.

 

DELETE_BUTTON

Deletes the button which is available at the moment in grid toolbar. You need to pass only user command name to it. Can be use before or after first output. The demo of usage can be found in ZDEMO_FALV05.

    methods delete_button importing value(iv_functiontype ui_func.

 

SET_CELL_DISABLED , SET_CELL_ENABLED, SET_CELL_BUTTON, SET_CELL_HOTSPOT

All above methods works only if you've previously set style field name for cells in layout. All of them has field name and row number as parameters. Demo ZDEMO_FALV09 shows the usage.

    methods set_cell_disabled importing value(iv_fieldnametype fieldname
                                        value(iv_row)       type lvc_s_roid-row_id.
    methods set_cell_enabled importing value(iv_fieldnametype fieldname
                                       value(iv_row)       type lvc_s_roid-row_id.
    methods set_cell_button importing value(iv_fieldnametype fieldname
                                      value(iv_row)       type lvc_s_roid-row_id.
    methods set_cell_hotspot importing value(iv_fieldnametype fieldname
                                       value(iv_row)       type lvc_s_roid-row_id.

 

SET_ROW_COLOR

Sets a color for a a given row number. Demo ZDEMO_FALV10 shows the usage. In next releases color will be unified in all methods.

    methods set_row_color importing value(iv_colortype char04
                                    value(iv_row)   type lvc_s_roid-row_id.

 

SET_CELL_COLOR

Sets a color for a a given field and row number. Demo ZDEMO_FALV10 shows the usage. In next releases color will be unified in all methods.


    methods set_cell_color importing value(iv_fieldnametype fieldname
                                     value(iv_color)     type lvc_s_colo
                                     value(iv_row)       type lvc_s_roid-row_id.

 

MASS_REPLACE

Mass replace function was described in this article and I've decided to include this into FALV project. So you can call it yourself or you can just add function FC_MASS_REPLACE grid or GUI toolbar of FALV and it will be handled automatically. Demo can be found in ZDEMO_FALV08.

methods mass_replace.

 

EVT_BUTTON_CLICK_FALV, EVT_USER_COMMAND, EVT_HOTSPOT_CLICK, EVT_DATA_CHANGED, EVT_DATA_CHANGED_FINISHED, EVT_DOUBLE_CLICK, EVT_ONF1, EVT_ONF4, EVT_SUBTOTAL_TEXT, EVT_BEFORE_USER_COMMAND, EVT_AFTER_USER_COMMAND, EVT_MENU_BUTTON, EVT_TOOLBAR, EVT_AFTER_REFRESH,

All this methods are only creted to be handler of an grid event. So if you want to use them you have to redefine them in your local or dicitionary class which inherits from ZCL_FALV. For example demo ZDEMO_FALV02 shows how to use them.
 
 

EVT_AT_SET_PF_STATUS

This is an event handler for event AT_SET_PF_STATUS which is triggered on full screen or popup FALV. To use it you have   to redefine them in your local or dicitionary class which inherits from ZCL_FALV.

    methods evt_at_set_pf_status
         for event at_set_pf_status of zcl_falv .

 

EVT_AT_SET_TITLE

This is an event handler for event AT_SET_TITLE which is triggered on full screen or popup FALV. To use it you have   to redefine them in your local or dicitionary class which inherits from ZCL_FALV.

    methods evt_at_set_title
         for event at_set_title of zcl_falv .

 

Attributes

FC_BACK  Constant - User Command 'BACK' - used in full screen FALV
FC_UP  Constant - User Command 'UP' - used in full screen FALV
FC_EXIT  Constant - User Command 'EXIT' - used in full screen FALV
FC_CANCEL  Constant - User Command 'CANCEL' - used in full screen FALV and popup FALV
FC_MASS_REPLACE  Constant - User Command 'MASS_REPL' 
FC_SAVE  Constant - User Command '&DATA_SAVE' - used in full screen FALV & Grid Toolbar
FC_PRINT  Constant - User Command 'PRINT' - used in full screen FALV
FC_FIND  Constant - User Command 'FIND' - used in full screen FALV
FC_FIND_NEXT  Constant - User Command 'FINDNEXT' - used in full screen FALV
FC_FIRST_PAGE  Constant - User Command 'PGHOME' - used in full screen FALV
FC_LAST_PAGE  Constant - User Command 'PGEND' - used in full screen FALV
FC_PREVIOUS_PAGE  Constant - User Command 'PGUP' - used in full screen FALV
FC_NEXT_PAGE   Constant - User Command 'PGDOWN' - used in full screen FALV
BUTTON_NORMAL  Constant - Normal button type for ADD_BUTTON function
BUTTON_MENU_DEFAULT  Constant - Default Menu button type for ADD_BUTTON function
BUTTON_MENU  Constant - Menu button type for ADD_BUTTON function
BUTTON_SEPARATOR  Constant - Separataor button type for ADD_BUTTON function
BUTTON_RADIOBUTTON  Constant - Radiobutton button type for ADD_BUTTON function
BUTTON_CHECKBOX  Constant - Checkbox button type for ADD_BUTTON function
BUTTON_MENU_ENTRY  Constant - Menu Entry button type for ADD_BUTTON function
MAIN_CONTAINER  Read-only - Contains main container for grid/split container.
SPLIT_CONTAINER  Contains split container object if embedded log is used
VARIANT  Variant settings for grid
LAYOUT_SAVE  Settings for saving of grid variants.
EXCLUDE_FUNCTIONS  Table with excluded functions from grid at creation
FCAT  Fieldcatalog
SORT  Table of Sorting sequence for the creation of grid
FILTER  Table for Filter settings at creation of grid
LVC_LAYOUT  Read-Only Layout variable for grid
LAYOUT  ZCL_FALV_LAYOUT object for FALV layout
GUI_STATUS  ZCL_FALV_DYNAMIC_STATUS object with Toolbar for full screen FALV
SCREEN  Screen number for full screen or popup FALV
OUTTAB  Reference of displayed table
TITLE_V1  First title variable for full screen or popup FALV
TITLE_V2  Second title variable for full screen or popup FALV
TITLE_V3  Third title variable for full screen or popup FALV
TITLE_V4  Fourth title variable for full screen or popup FALV
TITLE_V5  Fifth title variable for full screen or popup FALV
TOOLBAR_ADDED  Protected - Table with all buttons to be added to grid toolbar
TOOLBAR_DELETED  Protected - Table with all buttons to be deleted from grid toolbar
TOOLBAR_DISABLED  Protected - Table with all buttons to be disabled to grid toolbar
COLUMNS  Protected - Table with columns objects
BUILT_IN_SCREEN  Protected - Marked if built-in screen is used
APPLICATION_LOG_EMBEDDED  Protected - Marked if Error log is embedded into split container
SUBCLASS_TYPE  Protected - Subclass type used to create objects with redefinition