cancel
Showing results for 
Search instead for 
Did you mean: 

How to set first_visible_row for a table on a web dynpro

Former Member
0 Kudos

How can I set the attribute first_visible_row in a table which I placed on a Web Dynpro?

I need the table to scroll automatically to a specific row depending on a date. So I'm calling a method using this date, but how can I change the attribute of the table?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Follow these steps,

1- Create an attribute with char1 in the view context e.g first_vis_row

2- go to the table properties in view and bind the property first_visible_row to this attribute.

3- NOw go to the wddoinit method of the view...

4- read the internal table and find out the index of the row which you want to set as first row. As in ur case you want a specific date in first row. So read the internal table and findout the index.

5- now write this code, say your attribute name is first row inside node flag1...(you can change it for yoru requirement)

DATA lo_nd_flag1 TYPE REF TO if_wd_context_node.
  DATA lo_el_flag1 TYPE REF TO if_wd_context_element.
  DATA ls_flag1 TYPE wd_this->element_flag1.
  DATA lv_first_row LIKE ls_flag1-first_row.
* navigate from <CONTEXT> to <FLAG1> via lead selection
  lo_nd_flag1 = wd_context->get_child_node( name = wd_this->wdctx_flag1 ).

* get element via lead selection
  lo_el_flag1 = lo_nd_flag1->get_element(  ).

* get single attribute
  lo_el_flag1->get_attribute(
    EXPORTING
      name =  `FIRST_ROW`
    IMPORTING
      value = lv_first_row ).

here change the lv_first_row to the index which you got after raeading the internal table.

suppose it's

lv_first_row = 4.

  lo_el_flag1->set_attribute(
    EXPORTING
      name =  `FIRST_ROW`
      value = lv_first_row ).

Hope it works.

Answers (1)

Answers (1)

Former Member
0 Kudos

Now I got it, thank you!