Skip to Content
0
Former Member
Jul 13, 2007 at 03:57 PM

Select options dropdown populated with domain values?

732 Views

Hello,

How can i populate a drop down that i am creating using Select options with values of a domain? Currently i am creating the drop down in following manner:


lt_range_table = wd_comp_controller->m_handler->create_range_table(
        i_typename = `Z_SOME_DE` )

data: lt_value_set  type          wdy_key_value_table,
              ls_value_set  like line of  lt_value_set.

        ls_value_set-key   = '00'.
        ls_value_set-value = 'ABC'.
        insert ls_value_set into table lt_value_set.

        ls_value_set-key   = '01'.
        ls_value_set-value = 'BCD'.
        insert ls_value_set into table lt_value_set.

        ls_value_set-key   = '02'.
        ls_value_set-value = 'CDE'.
        insert ls_value_set into table lt_value_set.

        clear ls_value_set.
        ls_value_set-value = 'All'.
        insert ls_value_set into table lt_value_set.

        wd_comp_controller->m_handler->add_selection_field(
            i_id           = wd_this->typename
            it_result      = lt_range_table
            i_as_dropdown  = abap_true
            it_value_set   = lt_value_set
            i_within_block = grp_type ).

*** Select All as default selected value
        data: ls_tmprange type rsparams,
              lr_headerline  type ref to data.

        field-symbols: <fs_param> type any,
                       <fs_range> type any,
                       <fs_rangetable> type table.

        ls_tmprange-low    = ''.
        ls_tmprange-sign   = 'I'.
        ls_tmprange-option = 'EQ'.

        assign lt_range_table->* to <fs_rangetable>.
        create data lr_headerline like line of <fs_rangetable>.
        assign lr_headerline->* to <fs_range>.
        move-corresponding ls_tmprange to <fs_range>.
        append <fs_range> to <fs_rangetable>.

Now, what should i replace above code with so the data for Select options drop down gets populated from a domain instead of manually creating entries in the code and make the value All by default selected?

Thanks and Regards,

Vasu