Académique Documents
Professionnel Documents
Culture Documents
" To get the dropdowns displayed Need to set the table to editable by using below statement
LO_CONFIG->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( ABAP_FALSE ).
LO_CONFIG-
>IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROW_ALLOWED( ABAP_FALSE ).
LO_CONFIG-
>IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED( ABAP_FALSE ).
LO_CONFIG-
>IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_DELETE_ROW_ALLOWED( ABAP_FALSE ).
LO_CONFIG->if_salv_wd_table_settings~set_read_only( abap_false ).
Way1: Get object of individual column and set editor to input field
For example i want to make my client column editable in alv (MANDT)
Write below code
data : lr_inp type REF TO cl_salv_wd_uie_input_field.
create OBJECT lr_inp
exporting
value_fieldname = 'MANDT'
.
lv_value->if_salv_wd_column_settings~get_column( 'MANDT' )->set_cell_editor( value = lr_inp ).
Way2: Use standard API to make the cell editor changes to ALV
cl_wsrs_tools_wd_alv_table=>set_table_column( EXPORTING
io_column = <Pass Object of Column>
iv_editor_type = cl_wsrs_tools_wd_alv_table=>co_cell
_editor-<choose your editor type like inpu field etc>
iv_read_only = abap_true/abap_false
iv_column_text = <header text>
).
Now comes to making rows editable
Case 1: To keep all the rows as read only use below method of model object
lv_value->if_salv_wd_table_settings~set_read_only( ABAP_TRUE ).
Case 2: When you want all the rows editable in an ALV and user can enter data wherever they
want. Use below two methods of ALV model instance
**Allows mass edit of data
lv_value-
>if_salv_wd_table_settings~set_edit_mode( IF_SALV_WD_C_TABLE_SETTINGS=>edit_mode_ma
ss ).
**Makes read only mode to false
lv_value->if_salv_wd_table_settings~set_read_only( ABAP_FALSE ).
The advantage is, you don't need to worry about adding additional rows as and when user fills. ALV
will automatically adds the rows.
Case 3: When you want only the filled rows to be editable use edit mode as STANDARD
**Allows mass edit of data
lv_value-
>if_salv_wd_table_settings~set_edit_mode( IF_SALV_WD_C_TABLE_SETTINGS=>edit_mode_sta
ndard ).
**Makes read only mode to false
lv_value->if_salv_wd_table_settings~set_read_only( ABAP_FALSE ).
Case 4: When you want entire ALV in disable mode with some specific CELLS only enabled, we
need to use additional fields in context of table node. For every table column attribute create another
attribute with some name for eg. MANDT i create one more attribute MANDT_R of type
WDY_BOOLEAN.
Now set the read only field name for this cell using below API call
cl_wsrs_tools_wd_alv_table=>set_table_column( EXPORTING
io_column = <Pass Object of Column>
iv_editor_type = cl_wsrs_tools_wd_alv_table=>co_cell
_editor-<choose your editor type like inpu field etc>
iv_read_only = abap_true/abap_false
iv_column_text = <header text>
iv_readonly_fieldname = 'MANDT_R'
).
Now if you want only this cell to be editable. Use context programming to change the attribute flag
value in that particular row to ABAP_FALSE.
Lets say i want to make MANDT cell to be enabled in 3 rd row