cancel
Showing results for 
Search instead for 
Did you mean: 

Default selection of dropdown on FPM form UIBB

joltdx
Active Contributor
0 Kudos


Hi all!

I have an OVP with a FORM_UIBB containg two drop-downs with fixed values. They works just fine:

 

When I open the form in "Edit-mode", ie I fill the data structure from existing data i the GET_DATA method, the dropdowns show the ID of the value instead of the value itself:

I must be missing something obvious, but what is it? How to make the UIBB show the text for the value when settin in in GET_DATA?

Best regards

Jörgen Lindqvist

Accepted Solutions (1)

Accepted Solutions (1)

joltdx
Active Contributor
0 Kudos

Thank you Chandra, however that was basically my code as well.

The issue was in the definition of fixed values in the GET_DEFINITION method. Apparently the datatypes did not fully match for some reason, so the solution was to replace the following straight-forward code


lt_sec_class = zcl_sa2_configuration=>get_instance( )->get_sec_classes( ).

LOOP AT lt_sec_class ASSIGNING <sec_class>.

  APPEND INITIAL LINE TO lt_value_list ASSIGNING <value_list>.

  <value_list>-value = <sec_class>-sec_class.

  <value_list>-text = <sec_class>-description.

ENDLOOP.

with this one, where the values in the lt_value_list table is set using a string template.


lt_sec_class = zcl_sa2_configuration=>get_instance( )->get_sec_classes( ).

LOOP AT lt_sec_class ASSIGNING <sec_class>.

  APPEND INITIAL LINE TO lt_value_list ASSIGNING <value_list>.

  <value_list>-value = |{ <sec_class>-sec_class }|.

  <value_list>-text = |{ <sec_class>-description }|.

ENDLOOP.

The data type of the structure of my lt_sec_class table winds down to a INT1 for the sec_class and CHAR (64) for the description. I did not investigate this further, but maybe the issue would have never occured if the data type for sec_class would have been the more appropriate NUMC (2).

Take care all, and happy coding!

// Jörgen Lindqvist

Answers (1)

Answers (1)

former_member226239
Contributor
0 Kudos

Here is the code which is working for me (I don't have edit option).

In the get_definition method:

loop at lt_plant into ls_plant.

ls_value-value = ls_plant-werks.

ls_value-text    = ls_plant-name1.

append ls_value to lt_value.

endloop.

ls_field_desc-fixed_values = lt_value.

In the get_data method:

ls_data-werks = '1234'.

cs_data = ls_data.

ev_data_changed = abap_true.

Let me know how it goes.

Thanks,
Chandra Indukuri