cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the ALV-fieldcatalog table in WDA?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Amy

Thanks for reply.

I implemented your code and added ALV_TABLE as used component  but unfortunately I got a short dump:

"Component Usage ALV_TABLE Does Not Have an Active Component" 

Do you know why?

Thanks Kim

Former Member
0 Kudos

you have to first create a active component before  your code for configuring alv.

steps to create it.

1. click on wizard icon.

2. select radio button  Instantiate Used Component select your alv componet by using F4 in Component Use input field

this will put code .

if helpful reward points

Former Member
0 Kudos

Have you instantiated the component using

DATA : lo_cmp_usage TYPE REF TO if_wd_component_usage,

lo_cmp_usage =   wd_this->wd_cpuse_alv( ).

   IF lo_cmp_usage->has_active_component( ) IS INITIAL.

     lo_cmp_usage->create_component( ).

   ENDIF.

Regards, Vinod

Former Member
0 Kudos

Hi

Thanks that removed the short dump.

But how can I then modify the column e.g. make it editable, set text, tooptip, width etc?

Thank Kim

amy_king
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Amy

Thanks for very helpful reply but it seems complicated to code mayor fieldcatalog changes to WDA ALV list?

I wonder why there is no single fieldcatalog table like in classic ABAP and in POWL?

Thanks Kim

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Have you checked the method IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMNS of class CL_SALV_WD_CONFIG_TABLE ?

Regards, Vinod