cancel
Showing results for 
Search instead for 
Did you mean: 

WDA: Initialize Select Options

Former Member
0 Kudos

I am trying to initialize some select options and can't get it to work. In simple terms my screen should have a range of employee #'s and I want the range to default to = '1234' (i.e., just one employee nuimber as the default). I am new to this so if anyone could help it would be most appreciated ... and even more appreciated if you could give me exact code examples. thx very much and here i a copy of my code ..

data: lt_range_table type ref to data. "Range Table for select options

data: lo_componentcontroller type ref to ig_componentcontroller, "Component Controller

lo_cmp_usage type ref to if_wd_component_usage, "Componenent Usage for View

lo_el_context type ref to if_wd_context_element. "Context Element

data: lt_pernr TYPE table of SELOPT,

wa_pernr like line of lt_pernr.

field-symbols <fs_pernr> type table.

field-symbols <wa> type table.

  • Create component controller for error handling

lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).

  • Create the Used Component - The WDR_SELECT_OPTIONS Comonent from the Properties Tab

lo_cmp_usage = wd_this->wd_cpuse_select_options( ).

if lo_cmp_usage->has_active_component( ) is initial.

lo_cmp_usage->create_component( ).

endif.

  • Get reference to interface controller of select-options component & assign to our attribute;

wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).

  • Initialize the selection screen

wd_this->m_select_options_handler = wd_this->m_wd_select_options->init_selection_screen( ).

  • Create a range table that consists of the required data element

lt_range_table = wd_this->m_select_options_handler->create_range_table( i_typename = 'ZPERNR' ).

wa_pernr-sign = 'I'.

wa_pernr-option = 'EQ'.

wa_pernr-low = '1234'.

  • Add the selection field to the selection screen

wd_this->m_select_options_handler->add_selection_field(

i_id = 'PERNR'

it_result = lt_range_table

i_read_only = lv_read_only

i_obligatory = abap_true ).

assign lt_range_table->* to <fs_pernr>.

append wa_pernr to <fs_pernr>.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I fixed my own problem ... the code above actually works ... all I did was change

data: lt_pernr TYPE table of SEL_PERNR, (to point to the SEL_PERNR Structure).