cancel
Showing results for 
Search instead for 
Did you mean: 

how to display inserted records in a table

Former Member
0 Kudos

Hi i am created 4 fields named 'name' 'age' 'sex' 'district'

and a button named insert.

In the browser if i inserted the records and then click

the button means the records are updated into

the table.

Send me the coding...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kumar,

if the node for your table is input with four attributes name,age,sex,dist..

then write this code in the event handler of button;

data:

Node_Input type ref to If_Wd_Context_Node,

Elem_Input type ref to If_Wd_Context_Element,

Stru_Input type Wd_This->Element_Input ,

Item_name like Stru_Input-name,

Item_age like Stru_Input-age,

Item_sex like Stru_Input-sex,

Item_dist like Stru_Input-dist,

wa type ztable(name of ur table),

itab type table of ztable.

Node_Input = wd_Context->get_Child_Node( Name = wd_This->wdctx_Input ).

Elem_Input = Node_Input->get_Element( ).

Elem_Input->get_Attribute(

exporting

Name = `name`

importing

Value = Item_name ).

Elem_Input->get_Attribute(

exporting

Name = `age`

importing

Value = Item_age ).

Elem_Input->get_Attribute(

exporting

Name = `sex`

importing

Value = Item_sex ).

Elem_Input->get_Attribute(

exporting

Name = `dist`

importing

Value = Item_dist ).

wa-name = Item_name.

wa-age = Item_age.

wa-sex= Item_sex.

wa-dist= Item_dist.

insert into ztable(name of table) values wa.

or

u wil get the code from webdynpro code wizard.

Edited by: srilalitha yerramsetti on Jun 18, 2008 3:19 PM

Edited by: srilalitha yerramsetti on Jun 18, 2008 3:20 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Just add a new element to the context node binded with the table and it will be showed in the table.


  DATA
    lr_plot TYPE REF TO if_wd_context_node.

  lr_plot = wd_context->get_child_node( name = wd_this->wdctx_plot ).
  IF lr_plot IS INITIAL.
    RETURN.
  ENDIF.

  wd_this->element = lr_plot->create_element( ).
  lr_plot->bind_element( new_item = wd_this->elemento set_initial_elements = abap_false ).
  lr_plot->move_last( ).

Regards.