Skip to Content
author's profile photo Former Member
Former Member

New node element not shown on table

Hi

I have a webdynpeo view with a table and a button. On clicking the button a blank row shuold be added to the table. The code is as following:

node_trn_det_1 = wd_context->get_child_node( name = if_tlp_main=>wdctx_trn_det_1 ).

data ctr type i.

CALL METHOD node_trn_det_1->get_element_count

receiving

count = ctr.

elem_trn_det_1 = node_trn_det_1->create_element( ).

elem_trn_det_1->set_static_attributes( static_attributes = stru_trn_det_1 ).

node_trn_det_1->bind_element( new_item = elem_trn_det_1

set_initial_elements = abap_false ).

CALL METHOD node_trn_det_1->get_element_count

receiving

count = ctr.

Initially ctr returns 0 and after binding the new element it returns 1, meaning the new element is added to the node. But the table is still empty. Can anyone help?

Regds

Thiru

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 17, 2008 at 10:12 AM

    This is a bug in the program. I was initialising the table in the DoModifyView, but didnt check for the firsttime flag.

    Regds

    Thiru

    Add a comment
    10|10000 characters needed characters exceeded

    • >

      > hi thiruvengadam......

      >

      >

      > for inserting a blank row you need not complicate yourself.

      >

      > in the on action button,

      > just read the entire table into an internal table.

      > insert an empty row.

      > bind it again to the table.

      >

      >

      >  DATA lo_nd_table_mara_2 TYPE REF TO if_wd_context_node.
      >   DATA lo_el_table_mara_2 TYPE REF TO if_wd_context_element.
      >   DATA: ls_table_mara_2 TYPE table of mara,
      >         wa_table like line of ls_table_mara_2.
      > 
      > * navigate from <CONTEXT> to <TABLE_MARA_2> via lead selection
      >   lo_nd_table_mara_2 = wd_context->get_child_node( name = wd_this->wdctx_table_mara_2 ).
      > 
      > * get all declared attributes
      >   lo_nd_table_mara_2->get_static_attributes_table(
      >     IMPORTING
      >       table = ls_table_mara_2 ).
      > 
      >      wa_table_mara_2-matnr = ''.
      >      append wa_table_mara_2 to ls_table_mara_2.
      >      lo_nd_table_mara_2->bind_table( ls_table_mara_2 ).
      > 

      >

      > ---regards,

      > alex b justin

      Actually from a performance standpoint that will be quite costly - to read the entire table out and then set it back in again. Far better to just use the bind_element with the set_intitial_elements = abap_false. This lets you set one new element into the context without all the overhead.

  • author's profile photo Former Member
    Former Member
    Posted on May 19, 2008 at 04:44 AM

    Hi,

    pass the new record data to an internal table and then use

    node->bind_table(itab)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.