cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown by Index in ALV

jitin_kharbanda
Participant
0 Kudos

Hi,

I'm working on an ALV where I need to populate 2 dropdown columns(A & B) depending on 1 dropdown column (C).

Columns A & B are dropdown by Index

Columns C is dropdown by key

I'm maintaining same settings for both columns (A & B)

CREATE OBJECT lr_dropdown_idx

         EXPORTING

           selected_key_fieldname = 'A'.

       lr_dropdown_idx->set_read_only_fieldname( 'A_OP' ).

       lr_dropdown_idx->set_valueset_fieldname( 'A_VALUESET' ).

       CALL METHOD lr_dropdown_idx->set_type

         EXPORTING

           value = if_salv_wd_c_uie_drdn_by_index=>type_key_convert_to_value.

       ls_columns-r_column->set_width( value = '15' ).

       ls_columns-r_column->set_cell_editor( lr_dropdown_idx ).

       lr_alv_header = ls_columns-r_column->get_header( ).

       lr_alv_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).

CREATE OBJECT lr_dropdown_idx1

         EXPORTING

           selected_key_fieldname = 'B'.

       lr_dropdown_idx1->set_read_only_fieldname( 'B_OP' ).

       lr_dropdown_idx1->set_valueset_fieldname( 'B_VALUESET' ).

       CALL METHOD lr_dropdown_idx1->set_type

         EXPORTING

           value = if_salv_wd_c_uie_drdn_by_index=>type_key_convert_to_value.

       ls_columns-r_column->set_width( value = '15' ).

       ls_columns-r_column->set_cell_editor( lr_dropdown_idx1 ).

       lr_alv_header = ls_columns-r_column->get_header( ).

       lr_alv_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).

I'm preparing valueset tables at ON_CELL_ACTION event on ALV.

I can see in debugg mode that my Value sets are correct and are perfectly assigned to respective fields of my ALV table node.

Following is the code that I mentioned at ON_CELL_ACTION after populating value sets for both columns(A & B)

* Binding data to ALV table

     lv_node->bind_table( new_items = lt_user_table_list set_initial_elements = abap_true ).

     DATA: lv_cmp_alv_usage TYPE REF TO if_wd_component_usage.

     DATA: lv_interfacecontroller TYPE REF TO iwci_salv_wd_table .

     DATA: lv_alv_config_tab TYPE REF TO cl_salv_wd_config_table.

     lv_cmp_alv_usage  = wd_this->wd_cpuse_alv_usage( ).

     IF lv_cmp_alv_usage->has_active_component( ) IS INITIAL.

       lv_cmp_alv_usage->create_component( ).

     ENDIF.

     lv_interfacecontroller =   wd_this->wd_cpifc_alv_usage( ).

     lv_interfacecontroller->set_data( r_node_data = lv_node ).

* Rebuild ALV

wd_this->alv_setting( ).

Issue

1) when I select any value from column C, Column A gets populated perfectly depending on value of C, but Column B doesn't. If there are 10 values in value set of Column B, then I can see 10 blank lines in Column B.

2) when I append a row to the ALV or click on any other button/event, values of Column A disappears (same behavior as of Column B, no values, only blank lines).

Please suggest, it is URGENT.


Accepted Solutions (1)

Accepted Solutions (1)

jitin_kharbanda
Participant
0 Kudos

Just to add:-

1) I'm able to save values of A and B, but values are not being displayed in ALV.

2) I removed column A from ALV, I'm then column B works fine.

3) even after swapping the positions of A and B, no text is displayed for column B. Only A works fine.

jitin_kharbanda
Participant
0 Kudos

I resolved it myself by using

       CALL METHOD lr_dropdown_idx->set_type

         EXPORTING

           value = if_salv_wd_c_uie_drdn_by_index=>type_key_value.

Answers (0)