cancel
Showing results for 
Search instead for 
Did you mean: 

how to diplay table row dynamically by button click

Former Member
0 Kudos

Hi All,

I had a table with with visible row count '3', i want to display dynamic row by a button click, mean a 4 th row need to be added to the table with same like row '3'.

please help me ..

Thanks,

Raj.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raju,

while click the Add Button,

Get the all the Rows from the Table and Put it in to one internal table . after that append the one empty record to that internal table. then again bind to that node.

Like following code.

DATA lo_nd_sales TYPE REF TO if_wd_context_node.

DATA lo_el_sales TYPE REF TO if_wd_context_element.

DATA ls_sales TYPE wd_this->element_sales.

DATA lt_sales TYPE wd_this->elements_sales.

  • navigate from <CONTEXT> to <SALES> via lead selection

lo_nd_sales = wd_context->get_child_node( name = wd_this->wdctx_sales ).

  • get element via lead selection

lo_el_sales = lo_nd_sales->get_element( ).

CALL METHOD lo_nd_sales->get_static_attributes_table

  • EXPORTING

  • from = 1

  • to = 2147483647

IMPORTING

table = lt_sales

.

IF lt_sales IS NOT INITIAL.

CLEAR ls_sales.

APPEND ls_sales TO lt_sales.

lo_nd_sales->bind_table( lt_sales ).

ENDIF.

Regards,

Vijay.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

question is not clear.

Are you want to add a record to the Table on button click ?

or

you want to change the Visible Row Count dynamically?

Abhi

Former Member
0 Kudos

Hi Abhi,

thanks for ur quick reply,

i want to add a record at runtime(dynamically), if user wants to add more than 3 rows then he click on "Addmoreline" button then it should display a row .

Thanks,

RAj.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

1. Adding a record

data: lr_node type ref to if_wd_context_node.

data: lr_element type ref to if_wd_cotnext_element.

data: lr_stru type <context node structure>

lr_node = wd_context->get_child_node( '<child node name>' ).

lr_element =

lr_node->bind_element( new_item = lr_stru set_initial_elements = abap_false ).

2. I think your Visible row count property is 3 and you don't want to change it when more than 3 records are added at the same time you want the newly added record as the first record

Create a context attribute of type Integer and bind it to the firstVisibleRow property of the Table

and when user clicks AddMore button increment this by 1 and set it

Abhi