on 03-15-2013 3:26 PM
Hi,
I have an ALV table view with 4 fields visible:
PERNR
ENAME
SDATUM
EDATUM
These are all attributes of my custom Z table.
The user enters a value in PERNR either manually or from F4 selection. After having pressed ENTER on the number (PERNR), it has to fill ENAME with
the name from infotype PA0001. However, there is no onENTER event for the nodes. Will I use supply function on my node for this or where to place the lookup ?
Thanks in advance for your input.
you can use ON_CELL_ACTION event of ALV.
your cell detail will be stored in R_PARAM parameter.
if helpful reward points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi and thanks for your input,
What I have done till now is:
1. I have created an event handler named ON_CELL_ACTION.
2. Then I went to wddomodifyview and coded this below to activate ON_CELL_ACTION. This is placed in my ALV view.
Now I just need to know how to lookup the ENAME from infotype PA0001 using PERNR.
Can that be done "normally" reading the attribute ?
Peter
****
Code for wddomodifyview:
* Here we activate the event handler of on_cell_action for looking up name of employee
* Data Declaration
DATA: lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table,
lo_value TYPE REF TO cl_salv_wd_config_table.
* Instantiate ALV
lo_cmp_usage = wd_this->wd_cpuse_alv_test( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv_test( ).
* Call get_model of Interface Controller to get reference of ALV
lo_value = lo_interfacecontroller->get_model(
).
* Enable the ON_CELL_ACTION Event
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
Hi
Yes, after those steps you just need to instantiate the node and set it as table operation.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lt_node TYPE wd_this->elements_node.
* navigate from <CONTEXT> to <node> via lead selection
lo_nd_mara = wd_context->get_child_node( name = wd_this->wdctx_mara ).
* @TODO handle non existant child
* IF lo_nd_node IS INITIAL.
* ENDIF.
* * @TODO compute values
* * e.g. call a model function
<Write your select query here in this to retrieve the data from PA0001 into table lt_node.>
*
lo_nd_mara->bind_table( new_items = lt_node set_initial_elements = abap_true
Hi,
I have now modifed/adjusted your code in ON_CELL_ACTION, but I still do not get a NAME
from PERNR in my ALV WD comp.
Code:
METHOD on_cell_action .
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lt_node TYPE wd_this->elements_node_alv.
DATA ls_node TYPE wd_this->element_node_alv.
* navigate from <CONTEXT> to <node> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node_alv ).
* <Write your select query here in this to retrieve the data from PA0001 into table lt_node.>
SELECT SINGLE pernr ename
FROM pa0001
INTO ls_node
WHERE pernr = ls_node-pernr.
* lo_nd_node->bind_table( new_items = lt_node->set_initial_elements = abap_true ).
LOOP AT lt_node INTO ls_node.
APPEND ls_node TO lt_node[].
ENDLOOP.
lo_nd_node->bind_table( new_items = lt_node set_initial_elements = abap_true ).
ENDMETHOD.
METHOD wddomodifyview .
* Here we activate the event handler of on_cell_action for looking up name of employee
* Data Declaration
DATA: lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table,
lo_value TYPE REF TO cl_salv_wd_config_table.
* Instantiate ALV
lo_cmp_usage = wd_this->wd_cpuse_alv_test( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv_test( ).
* Call get_model of Interface Controller to get reference of ALV
lo_value = lo_interfacecontroller->get_model(
).
* Enable the ON_CELL_ACTION Event
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
ENDMETHOD.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.