cancel
Showing results for 
Search instead for 
Did you mean: 

refreshing ALV when action is triggered using button

Former Member
0 Kudos

Hello Friends,

I have a drop down list having 3 values "Last 30 Days", "Last 60 Days" and "Last 90 Days". If I select Last 30 Days and click on button "Search" it gives me record for the last 30 days. But, if I click again on "Last 60 Days" it duplicates the record that was already in. So it does not refresh the previous result. I have added the code as below to refresh ALV but, it refresh the table but not the ALV. My View name is "MY PO INVOICES" and the context node name is 'MY_PO_INV' .

DATA ln_node type REF TO if_wd_context_node.

ln_node = wd_context->get_child_node( 'MY_PO_INV' ).

ln_node->invalidate( ).

Please let me know how do I refresth the result in the ALV display when I trigger the event.

Thks & Rgds,

Hemal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hemal,

If i am correct, 'MY_PO_INV' is your node that is bound to your Dropdown list.

You want to refresh the ALV hence invalidate the node which store the ALV Data and rebind with the new values.

" clear the node
ln_node = wd_context->get_child_node( 'NODENAME ). " node for ALV 
ln_node->invalidate( ).

" rebind
ln_node->bind_table( itab_alv ) . " internal table name hich contains datd for last 60/90 days

Regards,

Radhika.

Former Member
0 Kudos

Hello All,

Thanks very much for your responses. I tried to bind the alv table. But, I think I am doing some thing wrong here. Below is my code. Please let me know where I am doing wrong. Appreciate your help.

lv_thirtydays = 'LAST 30 DAYS'.

lv_sixtydays = 'LAST 60 DAYS'.

lv_ninetydays = 'LAST 90 DAYS'.

if ZDAYS = lv_thirtydays.

lv_zpostingdate = sy-datum - 30.

ENDIF.

lv_zpostingdate_to = sy-datum.

if ZDAYS = lv_sixtydays.

lv_zpostingdate = sy-datum - 60.

ENDIF.

if ZDAYS = lv_ninetydays.

lv_zpostingdate = sy-datum - 90.

ENDIF.

ln_node = wd_context->get_child_node( 'MY_PO_INV' ).

ln_node->invalidate( ).

LOOP AT lt_context_value_set INTO cocd_context_value_set.

lv_zcompany = cocd_context_value_set-text.

lv_zusername = username.

lv_zdays = ZDAYS.

CALL FUNCTION 'ZEBP_MY_PO_INV_SEARCH'

EXPORTING

bldat = lv_zpostingdate

bldat_to = lv_zpostingdate_to

bukrs = lv_zcompany

usnam = lv_zusername

ZDAYS = lv_zdays

tables

invsrch = zsearch.

ln_node->bind_table( zsearch ) .

SORT zsearch BY zcompany.

DATA lo_nd_get_po_inv TYPE REF TO if_wd_context_node.

lo_nd_get_po_inv = wd_context->get_child_node( name = wd_this->wdctx_my_po_inv ).

CALL METHOD lo_nd_get_po_inv->bind_table

EXPORTING

new_items = zsearch.

ENDLOOP.

Thks & Rgds,

Hemal

Former Member
0 Kudos

hi,

I guess you are getting wrong values into your internal table which is binded to Table.

Just clear the contents of your attribute which is binded to Dropdown before reading its value.

I guess, Zdays is your context binded to dropdown and according to this context value read, you are doing further processing.

Just Clear the values of Zdays before reading its value.

I hope it will do.

Thanx.

Saurav.

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

you have to bind it again.

regards,

sid

Former Member
0 Kudos

Hi hemalgandhi

try to clean your context instead. For example placing this code when a user click search

it will claer whatever inside the context and then query your data.

DATA lt_TEST TYPE wd_this->elements_test.

data ls_TEST TYPE wd_this->element_TEST

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

lo_nd_test = wd_context->get_child_node( name = wd_this->wdctx_test ).

lo_el_test = lo_nd_test->get_element( ).

lo_el_test->get_static_attributes(

IMPORTING

static_attributes = ls_test ).

  • import table

lo_nd_test= wd_context->get_child_node( name = wd_this->wdctx_test ).

CHECK NOT lo_nd_testIS INITIAL.

CALL METHOD lo_nd_test->get_static_attributes_table

IMPORTING

table = lt_test.

CLEAR LT_TEST.

CLEAR LS_TEST.

Regards,

Abdul