on 04-08-2008 5:43 PM
I have an ALV table and in one of the columns I display a linkToAction in each cell.
When the link is clicked, i go to the ON_CLICK event handler and try to find out, which row is selected.
For this, I can take the attribute "INDEX" of the parameter "R_PARAM", and read the context with the given index.
METHOD alv_event_on_click .
DATA lo_nd_my_node TYPE REF TO if_wd_context_node.
DATA lt_my_table TYPE wd_this->elements_my_table.
DATA ls_my_structure TYPE wd_this->element_my_struture.
* click on prduct standard name link
IF r_param->attribute = 'NAME_OF_THE_COLUMN'.
lo_nd_my_node = wd_context->get_child_node( name = wd_this->wdctx_my_node ).
lo_nd_my_node->get_static_attributes_table( IMPORTING table = lt_my_table ). "this is not sorted!!!!
lo_nd_my_node->set_lead_selection_index( index = r_param->index ).
READ TABLE lt_my_table INTO ls_my_structure INDEX r_param->index. "lt_my_table table might be sorted differently!!!!
IF sy-subrc = 0.
wd_this->do_something_with( ls_my_strcture ).
ENDIF.
ENDIF.
ENDMETHOD.
However, this does not work when I sort the ALV before!
For a strange reason, the table that I get from the context is not sorted the same way as the data in the ALV.
What can I do?
Hi Daniel,
Do you use the sort of the ALV or do you sort the data in the node from within your coding.
I have just tested an example where i used the ALV sorting. When i retrieve the table, it's sorted exaclty the same as in my ALV.
I assume the node you are reading is also the one that is mapped to the ALV?
Regards,
Jos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
I don't know if the external mapping messes things up.
Perhaps you could try the following:
lo_nd_my_node->get_static_attributes(
EXPORTING
index = r_param->index
IMPORTING
static_attributes = ls_my_structure ).
It could be that passing the data towards your internal table doesn't take over the sort.
If you try debugging and check out the contents of the node, are they sorted correctly or not?
Regards and good luck.
Jos
Hi Jos,
I tried your suggestion, but it leads to the same problem.
I debugged into the method as suggested, and I saw that the table inside the context-node is not sorted in the same way than the ALV, but that is still has the initial sorting. Any other idea?
Thx for any help, and best regards,
Daniel
Hi Daniel,
Too bad the previous options didn't work out.
Have you tried the same without the external mapping?
Perhaps this external mapping and sorting don't work together properly.
What i can imagine is that the sorting that is done by the ALV component isn't passed back towards the external context node and therefore isn't sorted at the time you try to read the correct record.
Regards and good luck.
Jos
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.