on 01-15-2013 11:07 AM
Hi
I like to create/change/modify some ALV-fields settings dynamically in a WD Method.
In POWL their is a standard method for modifying the ALV-fieldcatalog but we dont have that in WDA.
How do I call/get the ALV-fieldcatalog in a table in WDA?
Thanks Kim Brandt
Hi Kim,
In the wddoinit method of either your component controller or view, you can access and modify the ALV columns as follows...
data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
data: lo_model type ref to cl_salv_wd_config_table.
lo_model = l_ref_interfacecontroller->get_model( ).
* Get a column
data: lr_column_settings type ref to if_salv_wd_column_settings,
lr_column type ref to cl_salv_wd_column.
lr_column_settings ?= lo_model.
lr_column = lr_column_settings->get_column( 'COLUMN_ID' ).
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kim,
You can change a column's cell editor to an InputField and disable the ALV's read-only default setting. Please take a look at the documentation for class CL_SALV_WD_COLUMN to learn what other column settings may be changed.
* set cell editor to input field
data: lr_column_settings type ref to if_salv_wd_column_settings,
lr_column type ref to cl_salv_wd_column,
lr_input_field type ref to cl_salv_wd_uie_input_field.
lr_column_settings ?= lo_model.
lr_column = lr_column_settings->get_column( 'COLUMN_ID' ).
create object lr_input_field
exporting
value_fieldname = 'COLUMN_ID'.
lr_column->set_cell_editor( lr_input_field ).
* set read only mode to false (also enables edit toolbar)
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= lo_model.
lr_table_settings->set_read_only( abap_false ).
Cheers,
Amy
I don't think any direct methods available other than what mentioned in her reply.
But instead of setting the properties individually, you can get the column list using the method
cl_salv_wd_config_table->if_salv_wd_column_settings~get_columns( ) and loop through the column list internal table
data : lo_cmp_usage type ref to if_wd_component_usage.
data : lt_column_ref type salv_wd_t_column_ref,
ls_column_ref type salv_wd_s_column_ref.
data : lv_value type ref to cl_salv_wd_config_table,
lo_interfacecontroller1 type ref to iwci_salv_wd_table,
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
lo_interfacecontroller1 = wd_this->wd_cpifc_alv( ).
lv_value = lo_interfacecontroller1->get_model( ).
lt_column_ref = lv_value->if_salv_wd_column_settings~get_columns( ).
loop at lt_column_ref into ls_column_ref.
* necessary column setting to be done here
endloop.
Internal table lt_column_ref will hold the columns used in ALV display.
Regards, Vinod
Hi,
Have you checked the method IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMNS of class CL_SALV_WD_CONFIG_TABLE ?
Regards, Vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.