fidley/falv

ZDEMO_FALV11 set_editable ABAP_FALSE still can editable

Closed this issue · 2 comments

Hi @fidley,

In demo ZDEMO_FALV11, set_editable ABAP_FALSE still can editable.

image

Here the code:

"! This is demo for FALV with edit settings
"! done by Lukasz Pegiel for http://abapblog.com
REPORT ydemo_falv11_b.

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.


PARAMETERS: p_whole  RADIOBUTTON GROUP gr1 DEFAULT 'X',
            p_column RADIOBUTTON GROUP gr1,
            p_cell   RADIOBUTTON GROUP gr1.


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_FALV11'.

  IF p_whole EQ abap_true.
    "set whole grid editable
    falv->layout->set_edit( abap_true ).
  ELSEIF p_column EQ abap_true.
    falv->column( 'SEATSMAX' )->set_edit( abap_true ).
    falv->column( 'PLANETYPE' )->set_edit( abap_true ).
  ELSE.
    "Set style column name
    falv->layout->set_stylefname( 'STYLES' ).
    DO 20 TIMES.
      falv->set_cell_enabled(
        EXPORTING
          iv_fieldname = 'FLDATE'
          iv_row       = 2 * sy-index
          ).
    ENDDO.
  ENDIF.

  "Change grid to edit mode
*  falv->set_editable( iv_modify = abap_true ).
  falv->set_editable( iv_modify = abap_false ).

  "Display full screen grid
  falv->display( ).

The ALV still can editable, can you explain it?

Thank you

Hi @wellys3

use falv->set_editable ( true or false) - to control how ALV should react to change data.

falv->set_editable ( True ) event cl_gui_alv_grid=>mc_evt_modified is registered
To make ALV react to data change automatically when the user moves the cursor without any need to hit on ENTER.

falv->set_editable ( False ) event cl_gui_alv_grid=>mc_evt_enter is registered
To make ALV react to data change with the user has to hit enter.

Run program ZDEMO_FALV08 with falv->set_editable ( True ) or false. Enter invalid data on the currency column. when falv->set_editable true alv show error immediately and when falv->set_editable false validation happens when the user hit enter.

image

we can use the following three options to make ALV editable.

set whole grid editable
falv->layout->set_edit( abap_false ).

set column editable
falv->column( 'SEATSMAX' )->set_edit( abap_true ).

set cell editable
falv->layout->set_stylefname( 'STYLES' ).
falv->set_cell_enabled(

Thank you.

Hi @vidyadharg,

I think, i can change view like picture below, with syntax: falv->set_editable( abap_false ).
image

But, it can't

Btw, thank you very much for your help.