Skip to Content
Aug 01, 2008 at 09:35 PM

WD4A DropDown By Index Problem


Hi guys! Here is my problem:

I create a sample WebDynpro application with 2 windows: (like a maintenance screen with 2 windows)

My first window display a list of employees with the ALV component usage, I also add some buttons in the ALV toolbar, like New, Edit..

The second window is to display the selected line in a popup window, where the user can create or edit employee information.

In my popup window, I have somes fields that used dropdownlist by index.

My component controller context looks like this:

EMPLOYEES (Cardinality 0:N)

EMPLOYEE (Cardinality 1:1)

These 2 context nodes have the same data type, I also have an attribute called status.

My attribute status needs to be display on a dropdown list. For that, I create another context (status) with a supply function to display the default value, I uncheck the init. lead selection, cardinality (1:N), selection (1:1).

When the user select an employee and click on edit by example, I am retrieving the lead selection item from my context node employees and bind it to the other context employee. Finally, the problem is that when I pass back my data, my dropdown list is empty. Let say the selected employee have status = 2, in the popup window the status field is empty by default, I the value are populated in the dropdown, but I was expected to see the value 2. I hope it's clear.

My code for the edit button looks like this

DATA: lr_nd_employees TYPE REF TO if_wd_context_node,
        lr_nd_employee  TYPE REF TO if_wd_context_node.

  DATA: ls_employees TYPE ig_componentcontroller=>element_employees,
        ls_employee  TYPE ig_componentcontroller=>element_employee.

  lr_nd_employees = wd_context->get_child_node( 'EMPLOYEES' ).

  lr_nd_employee  = wd_context->get_child_node( 'EMPLOYEE' ).

  lr_nd_employees->get_static_attributes( IMPORTING static_attributes = ls_employees ).

  MOVE-CORRESPONDING ls_employees TO ls_employee.

  lr_nd_employee->set_static_attributes( ls_employee ).

  popup_window( ).