on 05-05-2011 12:37 PM
Hi ,
I have a field in my view and i use a "freely programmed search help" to implement the F4 function as it is shown in this tutoriel.
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50fd6096-a4b6-2d10-bfa8-bb|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50fd6096-a4b6-2d10-bfa8-bb]
I want to permit multiple selection in the search help and retreive all values in one table ( or a list or anything else ... ).
Can someone help to achieve this please ?
Thanks in advance.
Hi,
If you have used freely programmed help then the control is on your hands.
What you can do is
1.) Set the node selection to (0..n ) So that it is possible to select more rows.
2)On Select button action, use the if_wd_context_node method get_selected_elements to get the selected elements
3) Pass this table to the receiving component via the event parameters or you can share the context and do the step-2 in the receiving component.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all ,
Thanks for your reponses.
I'm going to try kranthi kumar's idea and then if there is no solution using this way i will use the OVS.
Here is what i have in my ONACTIONSUBMIT method that is triggred when i submit the selected values in my pop-up search help.
The problem that I face right now is that i can't find a way to retreive all selected rows.
I tryed get_selected_elements () but i have errors with it.
Any help to correct mistakes in this code :
method ONACTIONSELECT .
DATA lo_listener TYPE REF TO if_wd_value_help_listener.
DATA lv_attrib_name Type String.
DATA lo_nd_ESTPP TYPE REF TO if_wd_context_node.
DATA lo_el_ESTPP TYPE REF TO if_wd_context_element.
DATA ls_ESTPP TYPE wd_this->element_ESTPP.
DATA lv_PHRTEXT LIKE ls_ESTPP-PHRTEXT.
DATA lo_nd_ESTPP_SET TYPE WDR_CONTEXT_ELEMENT_SET.
types:
begin of estpp_stru_input,
phrcode type estpp-PHRCODE,
phrtext type estpp-PHRTEXT,
rem type estpp-REM,
end of estpp_stru_input.
data: ls_search_tab type standard table of estpp_stru_input,
ls_search_wa type estpp_stru_input.
* navigate from <CONTEXT> to <ESTPP> via lead selection
lo_nd_ESTPP = wd_context->get_child_node( name = wd_this->wdctx_ESTPP ).
CALL METHOD LO_ND_ESTPP->GET_SELECTED_ELEMENTS
EXPORTING
INCLUDING_LEAD_SELECTION = ABAP_true
RECEIVING
SET = lo_nd_estpp_set.
* get element via lead selection
lo_el_ESTPP = lo_nd_ESTPP->get_element( ).
lo_el_ESTPP->get_selected_attributes( importing ).
*
* get single attribute
* lo_el_ESTPP->get_attribute(
* EXPORTING
* name = `PHRTEXT`
* IMPORTING
* value = lv_PHRTEXT ).
* lo_nd_estpp_set->get_static_attributes_table( table ls_search_tab ).
lo_nd_estpp = lo_nd_estpp_set->get_element( ).
while lo_nd_estpp is not initial.
lo_nd_estpp->get_static_attributes( ).
lo_nd_estpp->get_static_attributes( ls_search_wa ).
append ls_search_wa to ls_search_tab.
lo_nd_estpp = lo_nd_estpp_set->get_element( ).
endwhile.
lo_listener = wd_comp_controller->value_help_listener.
lv_attrib_name = lo_listener->f4_attribute_info-name.
* lo_listener->f4_context_element->set_attribute( value = lv_PHRTEXT
* name = lv_attrib_name ).
lo_listener->f4_context_element->get_node( )->bind_table ( ls_search_input ).
wd_comp_controller->fire_vh_data_selected_evt( ).
wd_comp_controller->value_help_listener->close_window( ).
endmethod.
I'm sorry if the code is Incomprehensible.
The sole thing that i need is to retreive all selected elements in a table.
If someone has an example of source code doing this, it would be very helpful
Here a clearer version.
method ONACTIONSELECT .
DATA lo_listener TYPE REF TO if_wd_value_help_listener.
DATA lv_attrib_name Type String.
DATA lo_nd_ESTPP TYPE REF TO if_wd_context_node.
DATA lo_el_ESTPP TYPE REF TO if_wd_context_element.
DATA ls_ESTPP TYPE wd_this->element_ESTPP.
DATA lv_PHRTEXT LIKE ls_ESTPP-PHRTEXT.
DATA lo_nd_ESTPP_SET TYPE WDR_CONTEXT_ELEMENT_SET.
types:
begin of estpp_stru_input,
phrcode type estpp-PHRCODE,
phrtext type estpp-PHRTEXT,
rem type estpp-REM,
end of estpp_stru_input.
data: ls_search_tab type standard table of estpp_stru_input,
ls_search_wa type estpp_stru_input.
* navigate from <CONTEXT> to <ESTPP> via lead selection
lo_nd_ESTPP = wd_context->get_child_node( name = wd_this->wdctx_ESTPP ).
CALL METHOD LO_ND_ESTPP->GET_SELECTED_ELEMENTS
EXPORTING
INCLUDING_LEAD_SELECTION = ABAP_true
RECEIVING
SET = lo_nd_estpp_set.
lo_nd_estpp = lo_nd_estpp_set->get_element( ). "here is the error : lo_nd_estpp_set is not a reference variable
while lo_nd_estpp is not initial.
lo_nd_estpp->get_static_attributes( ls_search_wa ).
append ls_search_wa to ls_search_tab.
lo_nd_estpp = lo_nd_estpp_set->get_element( ).
endwhile.
lo_listener = wd_comp_controller->value_help_listener.
lo_listener->f4_context_element->get_node( )->bind_table ( ls_search_tab ).
wd_comp_controller->fire_vh_data_selected_evt( ).
wd_comp_controller->value_help_listener->close_window( ).
endmethod.
hi,
I have done some thing like this and it works
FIELD-SYMBOLS:
<fs> TYPE REF TO if_wd_context_element.
IF lo_nd_estpp[] IS NOT INITIAL.
LOOP AT lo_nd_estpp ASSIGNING <fs>.
CLEAR ls_search_wa.
<fs>->get_static_attributes(
IMPORTING
static_attributes = ls_search_wa ).
APPEND ls_search_wa TO ls_search_tab.
ENDLOOP.
endif.
Hi dyngry,
You need modufy your code a little bit as lo_nd_estpp_set is not ref variable. You neet loop this and take the values in referrence variable and get the values from that.
You can do as follows:-
loop at lo_nd_estpp_set into lo_el_ESTPP.
CALL METHODlo_el_ESTPP->get_static_attributes
IMPORTING
static_attributes =ls_search_wa .
append ls_search_wa to ls_search_tab.
endloop.
Regards,
Monishankar C
though it is possible, after you choose value from the hit list normally the field where we triggered F4 will be defaulted with selected value.
if you want get all the selected entries of table ( i mean table built by you ) in the search help, it can be done by triggering event whenever data is selected in the F4 and handle this event in your component by passing entire table as event parameter.
or by using context sharing also we can achieve this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
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.