Skip to Content
avatar image
Former Member

How to add a row to VIEW CONTAINER UI Element during initialisation?

Hi,

I have a table which is declared inside the V_MAIN under a tabstrip button.

It is a view container UI Element and It accepts user input.

Requirement:

I need to add a row (selected from database) in this input table so that when the user reaches this tab he sees a default entry.

What I have done so far

viewcontainerui-element.png

I tried adding code in the WDDOINIT method of the V_MAIN. But the BIND_TABLE logic did not work as intended. Here is the code I added.

*--User wants to default an intermediate approver in the Approval Tab
  DATA lo_nd_approv_list TYPE REF TO if_wd_context_node.
  DATA lo_el_approv_list TYPE REF TO if_wd_context_element.
  DATA lt_approv_list TYPE wd_this->elements_approv_list.
  DATA ls_approv_list TYPE wd_this->element_approv_list.

*--navigate from <CONTEXT> to <APPROV_LIST> via lead selection
  lo_nd_approv_list = wd_context->get_child_node( name = wd_this->wdctx_approv_list ).

*-- Get default row from database.
  wd_this->add_default_approver( RECEIVING es_dpipco1300 = ls_dpipco1300 ).
*-- Add this row to the internal table 
  CLEAR ls_approv_list.
  <.....>
  APPEND ls_approv_list TO lt_approv_list.

*--Bind the data to the Webdynpro table UI element to add the default entry
lo_nd_approv_list->bind_table( lt_approv_list ).

This code does not work. No new row is added to the input table.

In INITIALIZATION event the code does not work. But it works when added to the ONACTION_ADD button event.

Could you suggest an alternative/ help/ corrections to the code.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 08 at 04:11 PM

    Hi,

    Got it to work now.

    Issue was running my code in the WDDOINIT method.

    It started working when I moved the exact same code into the WDDOMODIFYVIEW method.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 06 at 08:44 PM

    Hmmm, the code looks right.

    To ask the obvious, have you tried debugging? Is the value there when you debug?

    I wonder if the bug might be in your contexts? A view container will usually contain another view or component. So in this wddoinit you are working with the controller’s context. But the table will be based on another context, either the view or the component that it belongs to. Please check that these are bound correctly. If the button for the working code is in the same view as the table then that also points to a missing context binding. Or something else overwrites it.

    Add comment
    10|10000 characters needed characters exceeded