cancel
Showing results for 
Search instead for 
Did you mean: 

Retain Row Position On Binding

Former Member
0 Kudos

Hi Experts,

I have a table where the visible row count is 5, and say when i make changes to the row in 25 th position and bind the table with updated values on action save the new values are binded but the now the table is taken back to its first five rows as display, i would like to be able to see the 25th row even after binding the new updated table, i.e would want to retain table position.

Many Thanks In Advance,

Chaitanya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chaitanya,

Try the following steps:

1) Create an attribute 'L_CNT' type i

2) Bind this attribute to the "Visible Row Count" Property of the table.

3) Now in WDDOINIT set the default value to '5'

Use the following code

* set visible row count
  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lv_l_cnt LIKE ls_context-l_cnt.
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).

* set single attribute
  lo_el_context->set_attribute(
    EXPORTING
      name =  `L_CNT`
      value = '5' ).

4) Now once you bind the table, set your new row count .

node_vbap->bind_elements( lt_vbap ).

data: l_cnt type i.
DESCRIBE TABLE lt_vbap LINES l_cnt.

* get element via lead selection
  lo_el_context = wd_context->get_element(  ).

* set single attribute
  lo_el_context->set_attribute(
    EXPORTING
      name =  `L_CNT`
      value = l_cnt ).

Regards,

Radhika.

Former Member
0 Kudos

Many Thanks for the reply , i have a table that could have more that 1000 records at runtime so ur approach would not look pleasant on the screen , would need to work with changing the scroll position or somethng ................ so the question is till open...

Appreciate Ur Response

Chaitanya.

Edited by: Chaitanya Raju on Apr 22, 2009 10:32 AM

Former Member
0 Kudos

Hi Chaintanya,

I agree that the layout would not look pleasent using this approach.

I would like to add here, that if its an ALV table we can set the row to be visible after binding using "SET_FIRST_VISIBLE_ROW" method of the interface "IF_SALV_WD_TABLE_SETTINGS"

DATA: l_table_settings TYPE REF TO if_salv_wd_table_settings .
  l_table_settings ?= lo_value.
  l_table_settings->l_table->SET_FIRST_VISIBLE_ROW( '20' ).

Here i have hardcoded the value '20' , but you can pass the row number that you are editing.

Incase of a standard table, i am not sure how to achieve this.

Regards,

Radhika.

Former Member
0 Kudos

Radhika,

Used a similar approach to solve my problem , worked with the first visible row property of the table ...........

Thank You For Ur Inputs,

Chaitanya.

Answers (0)