cancel
Showing results for 
Search instead for 
Did you mean: 

More fun with enumerated dropdowns - Binding to table

Former Member
0 Kudos

Hi All,

I'm having some trouble with enumerated dropdowns.

My context is as follows:

node DATA 1...1

---> node FLIGHTS 0...N
   -->CARRID etc from SFLIGHTS

--->DDL (element type string)

I have successfully tried to add a simple dropdown with the following code on the component controller:

method wddoinit .

    data lo_nd_data type ref to if_wd_context_node.
    data lo_el_data type ref to if_wd_context_element.
    data ls_data type wd_this->element_data.
    data lv_ddl like ls_data-ddl.
    data node_info type ref to if_wd_context_node_info.
    data vals type table of  wdr_context_attr_value.
    data: s_element type wdr_context_attr_value.
    data: str type string.

*   navigate from <CONTEXT> to <DATA> via lead selection
    lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_data ).

*   get element via lead selection
    lo_el_data = lo_nd_data->get_element(  ).

    lo_el_data->get_static_attributes(
      importing
        static_attributes = ls_data ).

*      get node info
    call method lo_nd_data->get_node_info
      receiving
        node_info = node_info.

     do 25 times.
       str = sy-index.
       condense str no-gaps.
       s_element-text = str.
       s_element-value = str.
       append s_element to vals.
    enddo.

*    Set Value_sets to node_info
     call method node_info->set_attribute_value_set
      exporting
        name      = 'DDL'
        value_set = vals
        .
endmethod.

This works fine, however now I am trying the same thing with a field from the SFLIGHTS table.

I want to display a table of the retrieved SFLIGHTS but a field as a dropdown with valid entries from the database. I have added the following code to the view.

method WDDOINIT .

    data lo_nd_data type ref to if_wd_context_node.
    data lo_nd_flights type ref to if_wd_context_node.
    data lo_el_flights type ref to if_wd_context_element.
    data ls_flights type wd_this->element_flights.
    data gt_flights type table of sflights.

    select * from sflights into table gt_flights.

*   navigate from <CONTEXT> to <DATA> via lead selection
    lo_nd_data = wd_context->get_child_node( name = wd_this->wdctx_data ).

*   navigate from <DATA> to <FLIGHTS> via lead selection
    lo_nd_flights = lo_nd_data->get_child_node( name = wd_this->wdctx_flights ).

    lo_nd_flights->bind_table( gt_flights ).

       types: begin of ty_carrname,
     carrname type s_carrname,
     end of ty_carrname.

   data: gt_carrname type table of ty_carrname.

   select distinct carrname
      from sflights
      into table gt_carrname.


     data lv_carrname like ls_flights-carrname.
     data node_info type ref to if_wd_context_node_info.
     data vals type table of  wdr_context_attr_value.
     data: s_element type wdr_context_attr_value.
     data: str type string.

      lo_nd_flights->get_static_attributes(
      importing
        static_attributes = ls_flights ).

      call method lo_nd_flights->get_node_info
      receiving
        node_info = node_info.

     field-symbols: <carrname> like line of gt_carrname.

     loop at gt_carrname assigning <carrname>.
       str = <carrname>-carrname.
       s_element-text = str.
       s_element-value = str.
       append s_element to vals.
     endloop.

     call method node_info->set_attribute_value_set
      exporting
        name      = 'CARRNAME'
        value_set = vals.

endmethod.

I can display all the entries with a repeating subform but when I bind the CARRNAME to an enumerated dropdown I get an ADS rendering error:

WebDynpro Exception: The ADS call has failed. You can find information about the cause in the error.pdf on the application server

I have looked in the Error PDF but it is blank.

Does anyone have any suggestions on what is goign wrong or how to diagnose the problem.

I am assuming you can have a data element that has a 0..N cardinality (i.e a table element) and is also of type enumerated dropdown.

I'm guessing this is something to do with cardinality but I have no way to find out.

Thanks,

Gregor

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have looked in the defaultTrace file and found the following errors:

1.  A pdf document with 0 pages.
    Return Status: Render Failure
    Output Trace returned: <?xml version="1.0" encoding="UTF-8"?>
<log>
   <m mid="29184" tid="10064.4896" sev="f" d="2008-11-12T15:20:01.722Z">Malformed SOM expression: $record.sap-vhlist.FLIGHTS\\.DATA[*]\\.CARRNAME.item[*]</m></log>

Has anybody else used the enumerated dropdown element bound to dynamic data?

I am using the latest releases and the "Specify Item Values" on the Object->Binding tab is filled in with what looks correct ($record.sap-vhlist.FLIGHTS\.Data etc) but greyed out.

Thanks