cancel
Showing results for 
Search instead for 
Did you mean: 

WDA ALV - Dropdowns in one Column with different value sets

former_member1287623
Participant
0 Kudos

Hi,

I have an ALV with like 3 lines with dropdown fields, each line needs several dropdown values in the same column.

In BSP this is easy with an iterator but I couldn't find a possibility to do this in WDA.

At the moment my ALV Dropdown Fields for every line get filled from Context Value Set of the corresponding field - any Ideas how to create a single Dropdown for each Row and Column? (then I could supply every Dropdown the Value Table I want to see)

The other way would be not to change the ALV but the Context Value Sets - but I found no methods to change the Value Set for each row in a context table.

Other (working) ideas also Welcome.

thanks + regards,

Sebastian

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member1287623
Participant
0 Kudos

not even a "sorry this is not possible"?!

Former Member
0 Kudos

Dropdown By Index can be used to achieve this scenario.

Check this thread

[]

Hope it helps!

Regards,

Radhika.

former_member1287623
Participant
0 Kudos

Thanks Radhikar,

but I do already have such Dropdowns.

What I need now are different values in each Dropdown in ONE column.

In your example every Dropdown has the same values...

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Thanks Radhikar,

>

> but I do already have such Dropdowns.

>

> What I need now are different values in each Dropdown in ONE column.

> In your example every Dropdown has the same values...

That's should be the case. If you set the Singleton option correctly, you will get a new instance of the entire child node that conaints the dropdown values for each element in the parent. This allows you to have unique DDLB values per row in your table as you described that you wanted.

former_member1287623
Participant
0 Kudos

sounds plausible

I will give it a try

Former Member
0 Kudos

Hi,

When you refer this link-

To have the different values for each row then populate the different valuesets for each row by looping the table to which the ALV is bound.

DATA:

ls_value_set TYPE wdr_context_attr_value.

loop at lt_final into ls_final.
 
***For each row based on condition fill the valueset.
if sy-tabix eq 1. "1st row.
       ls_value_set-text  = space.
        INSERT ls_value_set INTO TABLE ls_final-valueset.
        ls_value_set-value = space.
        ls_value_set-text  = '1'.
        INSERT ls_value_set INTO TABLE ls_final-valueset.
elseif sy-tabix eq 2.
       ls_value_set-text  = space.
        INSERT ls_value_set INTO TABLE ls_final-valueset.
        ls_value_set-value = space.
        ls_value_set-text  = '1'.
        INSERT ls_value_set INTO TABLE ls_final-valueset.     "Diferene values
endif.
append ls_final to lt_final1.
clear ls_final.
endloop.

lt_final1 bind to the table.

Now get the column references of the node to which table is bound.

DATA: lr_node type ref to if_wd_context_node,

lr_info type ref to if_wd_context_node_info.

lr_node = wd_context->get_child_node( 'FINAL' ).

lr_info = lr_node->get_node_info( ).

Use GET_COLUMNS of cl_salv_wd_config_table to get column references.

declare a dropdown index element.

loop at the lt_columns into lr_cols.

when 'colname'.

CREATE OBJECT lr_drp_idx

EXPORTING

selected_key_fieldname = lv_id. "column name

lr_drp_idx->set_texts( 'VALUESET' ). "Attribute name of the node

or set_on_select to bind the valuset attribute

lr_cols->set_cell_editor( lr_drp_idx ).

endloop.

Regards,

Lekha.

former_member1287623
Participant
0 Kudos

Hi Thomas,

I now created a dummy node (since my node was on root layer and there is only singleton allowed).

But it still doesn't work.

I loop over the elements in the node under the dummy node (which is NOT set as singleton) and set the value set there for each line (element).

But unfortunately the ALV Output is still the same - all value sets are the same -.-

Hope u still have some hints for me

best regards,

Sebastian

former_member1287623
Participant
0 Kudos

Couldn't make it with the value set behind each attribute - even if it's not singleton...

Creating a new node and fill in there the DD Values for each row worked.

ChrisPaine
Active Contributor
0 Kudos

Hello Sebastian,

could you elaborate on how you made this work?

Did you have a table of nodes each with one element and show those elements in your table? I can see how something like this might work with hierarchical tables (using a master column) - but even in this case all elements within the same branch share the same node.

I can't see anyway of populating the dropdown by key values other than populating the valuelist of the attribute info (derived from node info) I certainly can't see any way to bind the valuelist on and element by element basis.

I believe there may be a solution using the dropdown by index - was this how you solved your problem?

I would be very interested to understand how you solved this problem.

Thanks!

Chris

former_member429661
Participant
0 Kudos

Hi Chris,

do you have became any information how to solve these problem ? I need the same solution.

Thanks for a fedback.

--Bernd

former_member429661
Participant
0 Kudos

Hi guys,

for all who lost in translation and landed on this question... i found a (the) solution for myself.

If you want different values in each dropdown in each cell of one column ( 'BKVID' ) ...

1. define a context node which is explicit for the alv. (that was my first error in reasoning)

2. add in that node an attribute 'BKVID_CONTEXT' with the type WDR_CONTEXT_ATTR_VALUE_LIST

3. fill the node with all data inclusive the value list 'BKVID_CONTEXT'

4. use dropdown by index for selection (that was my second error in reasoning. do not use dropdown by key)

* Declare variable to store column details
  
  DATA: ALV_CONFIG_TABLE  type REF TO CL_SALV_WD_CONFIG_TABLE.
  DATA: wd_table_usage TYPE REF TO if_wd_component_usage.
  DATA: wd_table TYPE REF TO iwci_salv_wd_table.

  DATA: 
        column_settings      TYPE REF TO if_salv_wd_column_settings,
        column                    TYPE REF TO cl_salv_wd_column,
        column_hdr             TYPE REF TO cl_salv_wd_column_header,
        lr_input_field           TYPE REF TO cl_salv_wd_uie_input_field,
        lr_dropdown_key   TYPE REF TO cl_salv_wd_uie_dropdown_by_key,

lr_dropdown_idx TYPE REF TO cl_salv_wd_uie_dropdown_by_idx, <== very important


        lr_text_editor_v  type REF TO CL_SALV_WD_UIE_TEXT_VIEW,
        lr_field                type ref to cl_salv_wd_field,
        lr_field_settings type ref to if_salv_wd_field_settings,
        lr_aggr_rule       type ref to cl_salv_wd_aggr_rule,
        lr_sort_rule        type ref to cl_salv_wd_sort_rule.
        
  wd_table_usage = wd_this->wd_cpuse_TC031_ZBI_AZP_ALV( ).
  IF wd_table_usage->has_active_component( ) IS INITIAL.
    wd_table_usage->create_component( ).
  ENDIF.

  wd_table = wd_this->wd_cpifc_TC031_ZBI_AZP_ALV( ).
  alv_config_table = wd_table->get_model( ).

  column_settings ?= alv_config_table.

  column = column_settings->get_column( 'BKVID' ).       
  column->set_visible( if_wdl_core=>VISIBILITY_VISIBLE ).

  CREATE OBJECT lr_dropdown_idx EXPORTING selected_key_fieldname = 'BKVID'.

  call METHOD lr_dropdown_idx->set_valueset_fieldname EXPORTING value = 'BKVID_CONTEXT'.
  call METHOD lr_dropdown_idx->set_type 
                       EXPORTING value = if_salv_wd_c_uie_drdn_by_index=>TYPE_KEY_VALUE.

  column->set_cell_editor( lr_dropdown_idx ).