on 08-18-2009 6:13 AM
Hi,
I am having selection field sales orderno and submit button, and alv control. when i select any sales orderno and click on submit button , i get relevant data in ALV . But again when i select new salesorderno in input field and click on submit button, it should refreshed ALV Output. But it shows me previous data only. I have output node calle op_node having no. of fields. when i click on submit button ,i filled internal table which i bind out node op_node . This table gets modified when i click on submit , it binds to op_node as well bt data in alv doesnt modified. so how to refresh ALV?
Thanks,
Saurin Shah
I sort out myself, using set_data method of ALV interface controller.
Thanks,
Saurin Shah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurin,
Try using 'Invalidate' method to refresh the node at the beginning of code in submit button
lo_nd_op_node->invalidate( ).
Regards,
Deepthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
where to use invalidate method for node op_node. because as u said if i keep in submit action method, after declaring node op_node if i invalidate through this method and then if i bind internal table to this node , it doesnt show me any output. I give u my code...where to write plz let me know...
method ONACTIONSUBMIT .
" get input from input node attribute VBELN.........
DATA LO_ND_INPNODE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_INPNODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_INPNODE TYPE WD_THIS->ELEMENT_INPNODE.
DATA LV_VBELN LIKE LS_INPNODE-VBELN.
navigate from <CONTEXT> to <INPNODE> via lead selection
LO_ND_INPNODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_INPNODE ).
get element via lead selection
LO_EL_INPNODE = LO_ND_INPNODE->GET_ELEMENT( ).
get single attribute
LO_EL_INPNODE->GET_ATTRIBUTE(
EXPORTING
NAME = `VBELN`
IMPORTING
VALUE = LV_VBELN ).
" Now to get data from vbak and keep into internal table and than bind to node opnode.
DATA LO_ND_OPNODE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_OPNODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_OPNODE TYPE WD_THIS->ELEMENT_OPNODE.
DATA: LT_OPNODE TYPE WD_THIS->ELEMENTS_OPNODE.
navigate from <CONTEXT> to <OPNODE> via lead selection
LO_ND_OPNODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_OPNODE ).
CALL METHOD LO_ND_OPNODE->INVALIDATE
.
Select * from VBAK INTO CORRESPONDING FIELDS OF TABLE LT_OPNODE
WHERE VBELN = LV_VBELN .
CALL METHOD LO_ND_OPNODE->BIND_TABLE
EXPORTING
NEW_ITEMS = LT_OPNODE
SET_INITIAL_ELEMENTS = ABAP_TRUE
INDEX =
.
endmethod.
Hi,
Hope you can statically bound the DATA node of the ALV but not by using the SET_DATA method.
One more thing, you have to code for BIND TABLE in the HANDLER method for inbound plug in the 2nd view or
Your retreival of data should be in the EXECUTE button, clear the table and bind the table again to node.
You can invalidate the node when you press previous button from 2nd to 1st view.
Donot write the code in the WDDOINIT or in WDDOMODIFYVIEW.
DATA LO_ND_OPNODE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_OPNODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_OPNODE TYPE WD_THIS->ELEMENT_OPNODE.
DATA: LT_OPNODE TYPE WD_THIS->ELEMENTS_OPNODE.
REFRESH: lt_opnode.
navigate from <CONTEXT> to <OPNODE> via lead selection
LO_ND_OPNODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_OPNODE ).
CALL METHOD LO_ND_OPNODE->INVALIDATE "Dont write here
.
Select * from VBAK INTO CORRESPONDING FIELDS OF TABLE LT_OPNODE
WHERE VBELN = LV_VBELN .
CALL METHOD LO_ND_OPNODE->BIND_TABLE
EXPORTING
NEW_ITEMS = LT_OPNODE
SET_INITIAL_ELEMENTS = ABAP_TRUE
INDEX =
.
Regards,
Lekha.
Hi Lekha,
If i dont write Invalidating method , than as per selection, i get output in ALV first time only . But when i change my seleciton criteria, it wont change the contents of ALV Output....
if i uncomment it , it doesnt show me any output even first time. Because first time when i click on submit button , it invalidate the node and then i bind with internal table...
Thanks,
Saurin Shah
Hi,
Are you evertime creating the node or are you storing the node in globally and binding the table to this global node.
Have you refreshed the table content or not. REFRESH statement.
if lo_nd_opnode is not initial
CALL METHOD LO_ND_OPNODE->INVALIDATE .
or
clear lo_nd_opnode
endif.
* navigate from <CONTEXT> to <OPNODE> via lead selection
LO_ND_OPNODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_OPNODE ).
Regards,
Lekha.
Hi Lekha,
I am refering node everytime , when i click on submit as shown below .. and then i bind internal table to node opnode. i checked everytime LO_ND_OPNODE is initial so INVALIDATE never gets called......
DATA LO_ND_OPNODE TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_OPNODE TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_OPNODE TYPE WD_THIS->ELEMENT_OPNODE.
DATA: LT_OPNODE TYPE WD_THIS->ELEMENTS_OPNODE.
if LO_ND_OPNODE is NOT INITIAL.
CALL METHOD LO_ND_OPNODE->INVALIDATE.
refresh LT_OPNODE.
endif.
navigate from <CONTEXT> to <OPNODE> via lead selection
LO_ND_OPNODE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_OPNODE ).
Select * from VBAK INTO CORRESPONDING FIELDS OF TABLE LT_OPNODE
WHERE VBELN = LV_VBELN .
CALL METHOD LO_ND_OPNODE->BIND_TABLE
EXPORTING
NEW_ITEMS = LT_OPNODE
SET_INITIAL_ELEMENTS = ABAP_TRUE
INDEX =
.
Thanks,
Saurin Shah
Hi,
After getting the node reference you keep that check.
In the debugging, check for the ndoe content and also the table content.
As you said that when Invalalidate is used 1st time you are able toget any data.
Check this step in debugging by commenting and uncommenting it.
SET_INITIAL_ELEMENTS as abap_false. "Try checking this as well.
Regards,
Lekha.
Hi,
I have written the following code in the onAction Method for fetching the Sales Orders from Material number.
It is working fine.
Regards,
Radhika.DATA: cn_input TYPE REF TO if_wd_context_node.
DATA: l_matnr TYPE mara-matnr.
DATA: l_view_controller TYPE REF TO if_wd_view_controller.
DATA: lt_msgs TYPE cl_wd_dynamic_tool=>t_check_result_message_tab.
DATA: lt_alv TYPE if_v_main=>elements_cn_alv,
ls_alv TYPE if_v_main=>element_cn_alv.
DATA: l_error TYPE boolean.
* get element via lead selection
DATA lo_el_context TYPE REF TO if_wd_context_element.
lo_el_context = wd_context->get_element( ).
* Get 'CN_ALV' from context node
DATA: cn_alv TYPE REF TO if_wd_context_node.
cn_alv = wd_context->get_child_node( 'CN_ALV' ).
* Get 'CN_INPUT' from context node
cn_input = wd_context->get_child_node( 'CN_INPUT' ).
* Get attribute CA_MATNR
cn_input->get_attribute( EXPORTING name = 'CA_MATNR'
IMPORTING value = l_matnr ).
* Get view controller
l_view_controller = wd_this->wd_get_api( ).
* Check for mandatory attribute
cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
EXPORTING view_controller = l_view_controller
display_messages = abap_true
IMPORTING messages = lt_msgs
).
IF lt_msgs IS INITIAL.
* Validate Material Number.
DATA: matnr TYPE mara-matnr.
SELECT SINGLE matnr
FROM mara
INTO matnr
WHERE matnr = l_matnr.
IF NOT matnr IS INITIAL.
* Get Sales Orders
SELECT vbeln
posnr
zmeng
arktx
FROM vbap
INTO TABLE lt_alv
WHERE matnr = l_matnr.
IF NOT lt_alv[] IS INITIAL.
* Initialize AL
initialize_alv( ).
* Bind Data to ALv
cn_alv->bind_table( lt_alv ).
CLEAR l_error.
ELSE.
l_error = abap_true.
* display Status message
wd_comp_controller->success_msg( 'No Data Exists' ).
ENDIF.
ELSE.
l_error = abap_true.
* Display Error Message.
wd_comp_controller->error_msg( 'Material does not Exist' ).
ENDIF.
IF l_error = abap_true.
* Clear ALV table
cn_alv->invalidate( ).
CLEAR l_error.
ENDIF.
ENDIF.
Hi,
I have not used any refresh or invalidate statement, my ALV is getting refreshed. Here is the code -
If you still find as not resolved, then delete the current alv and create it again and also map the DATA node of ALV again to the
VBAK node of yours. This should work fine.
On Submit button action -
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
).
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA ls_node TYPE wd_this->element_node.
DATA lv_vbeln TYPE wd_this->element_node-vbeln.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
* @TODO handle non existant child
* IF lo_nd_node IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_node = lo_nd_node->get_element( ).
* @TODO handle not set lead selection
IF lo_el_node IS INITIAL.
ENDIF.
* get single attribute
lo_el_node->get_attribute(
EXPORTING
name = `VBELN`
IMPORTING
value = lv_vbeln ).
DATA lo_nd_vbak TYPE REF TO if_wd_context_node.
DATA lt_vbak TYPE wd_this->elements_vbak.
* navigate from <CONTEXT> to <VBAK> via lead selection
lo_nd_vbak = wd_context->get_child_node( name = wd_this->wdctx_vbak ).
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE lt_vbak
WHERE vbeln = lv_vbeln.
* @TODO handle non existant child
IF lo_nd_vbak IS not INITIAL.
lo_nd_vbak->bind_table( lt_vbak ).
ENDIF.
Regards,
Lekha.
Hi,
Please write the context updation in domodify method and check. Please let me know if you are facing the problem again.
Thanks,
Sanjeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.