cancel
Showing results for 
Search instead for 
Did you mean: 

Bind data to table with dropdown column

Former Member
0 Kudos

Hi,

I am using a table with 2 dropdown columns. The table is binded to 'NODE1' and the dropdown columns are binded to sub node of NODE1 say node1.1 and node 1.2 repectively with cardinality0..n. My problem is when i am populating data to this table, I am using the statement node->bind_table(itab[]).But its populating all the fields in the table except that dropdown fields.

please help me to resolve the problem.

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos
method s_table_source.

* data declaration
  data:
    lt_table_source type if_main_view=>elements_table_source,
    table_source    like line of lt_table_source,
    lt_urls         type if_main_view=>elements_urls,
    url             like line of lt_urls,
    tabix           type sytabix,
    lr_element      type ref to if_wd_context_element,
    lr_child_node   type ref to if_wd_context_node.

* get all carriers
  cl_wd_flight_model=>get_scarr( importing et_scarr = lt_table_source ).

* bind all the elements
  node->bind_table(
    new_items =  lt_table_source
    set_initial_elements = abap_true ).

* fill the sub node with some URLs
  loop at lt_table_source into table_source.
    tabix = sy-tabix.
    clear lt_urls[].
    do 5 times.
      url-key = sy-index * tabix.
      condense url-key.
      concatenate `www.` url-key `.com` into url-url.
      insert url into table lt_urls.
    enddo.
    lr_element = node->get_element( tabix ).
    lr_child_node = lr_element->get_child_node( 'URLS' ).
    lr_child_node->bind_table( lt_urls ).
  endloop.
endmethod

Answers (3)

Answers (3)

uday_gubbala2
Active Contributor
0 Kudos

Now go to your tables desired cell editor & change the textview to DropDownByIndex . Now bind the "texts" property of the DropDownByIndex element to the URL attribute which we had created under node URLS. (i.e., MAIN_VIEW.TABLE_SOURCE.URLS.URL)

Now when you test your application you would have the table getting displayed with the DropDownByIndex filled with a set of values. All the scenario that I have explained is available for you in the standard SAP component DEMO_VARIABLE_DROPDOWN ! Check it out & you would understand as to how to implement the logic.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Mohammed,

Consider the case that you have 2 nodes TABLE_SOURCE & URLS. The node TABLE_SOURCE contains 3 attributes CARRID, CARRNAME & CURRCODE to be displayed in the table. In addition the table has a column which displays a list of URL's in a DropDownByIndex element.

So for this create the node URLS as a subnode of TABLE_SOURCE. Now under this node define 2 attributes:

URL type STRING & KEY type STRING.

To fill the values for these nodes define a SUPPLY FUNCTION (S_TABLE_SOURCE) for the parent node TABLE_SOURCE. Below is the coding within the supply function.

Regards,

Uday

Former Member
0 Kudos

Hi,

Check the example for WDR_TEST_TABLE and view TABLE_CELL_EDITORS. You can use the supply function to fill the data for that dropdown and bind the table to this subnode.

Regards,

Lekha.