Currently I set the dropdowns of an INT4 id
field as follows:
TYPES: BEGIN OF dropdown_column_ty,
columnname_handle TYPE lvc_fname,
columnname TYPE lvc_fname,
conv_exit TYPE lvc_edtmsk,
END OF dropdown_column_ty,
dropdown_column_tt TYPE STANDARD TABLE OF ty_dropdown_column WITH EMPTY KEY.
DATA: i_dropdown_values TYPE salv_t_value, " to be filled by external values
i_dropdown_columns TYPE dropdown_column_tt,
salv TYPE REF TO cl_salv_table.
< Stuff to initialize variables here >
LOOP AT i_dropdown_columns ASSIGNING FIELD-SYMBOL(<dropdown_columns>).
salv->get_columns( )->set_dropdown_entry_column( <dropdown_columns>-columnname_handle ).
FINAL(column) = CAST cl_salv_column_table( salv->get_columns( )->get_column( <dropdown_columns>-columnname ) ).
column->set_cell_type( if_salv_c_cell_type=>dropdown ).
column->set_dropdown_entry( 1 ).
column->set_edit_mask( <dropdown_columns>-conv_exit ).
ENDLOOP.
salv->get_functional_settings( )->get_dropdowns( )->add_dropdown( handle = 1
t_values = i_dropdown_values ).
And I get the dropdown values like this:
METHOD get_dropdown_values.
DATA dd07 TYPE STANDARD TABLE OF dd07v WITH NON-UNIQUE DEFAULT KEY.
CALL FUNCTION 'DDIF_DOMA_GET' EXPORTING name = 'DOMAIN_NAME'
langu = sy-langu
TABLES dd07v_tab = dd07
EXCEPTIONS illegal_input = 1
OTHERS = 2.
LOOP AT dd07 ASSIGNING FIELD-SYMBOL(<dd07>).
APPEND <dd07>-domvalue_l TO r_values.
ENDLOOP.
ENDMETHOD.
And that works for the Column itself like it should:
But the dropdown values still have their id
in it:
Given it's an editable SALV on that column, the user must choose the id
in the INT4 values, which enters the id
in the field. If he presses the enter key afterwards, the conversion exit gets applied (which converts the id
value to text, e.g. 0
into offen
). Plus, he can look at the F4 for the corresponding number.
But is there any way, I can apply the Conversion exit to the dropdown values itself too? Because if I replace the values with the text instead of the id, it will show them, but they won't be editable anymore, because there would be text instead of numbers in it, which the SALV's automatic check wouldn't allow... The current solution is a bit ugly like this, but I can't find a way.
System: ABAP 7.58
I just found the Solution by accident. I removed the explicit setting of the conversion exit:
cl_salv_column_table( r_salv-salv->get_columns( )->get_column( <dropdown_columns>-columnname ) )->set_edit_mask( <dropdown_columns>-conv_exit )
and instead, added it to the Domain itself. Then i changed the dropdown values from domvalue_l
to ddtext
to show the text. Now the automatic check accepts it and the texts are shown as wanted, but still uses the ID internally: