on 08-24-2011 11:12 AM
Hi Experts,
I need to implement F4 help for ALV table field.
I my scenario, I am using two views. If we click on any record in fist view then it displays the popup window (second view) with relevant record details.
Here one of the columns having fieldnames corresponding values (old values), for correcting old values I have created new value editable column, we can enter new value for old value then we can save it. Till this functionality is ok.
Then I have included OVS help for new value field. Here I need to get f4 help for newvalue field relevant to fieldname.
For example: user clicks on f4 in cell (new value) then if corresponding fieldname is u2018WERKSu2019 then it shows the plant values
Here I can get fieldname, domain name and value table using method set_attribute ().
Same concept I have implemented in ALV using F4IF_FIELD_VALUE_REQUEST. It is working fine
Here I have little bit confusion. Please advise me how to implement in OVS.
Regards,
BBC
Hi,
you'll have to create a method for the OVS search help (define it in the "OVS component usage" field in the context).
Sample code (should work for WERKS):
method on_ovs .
declare data structures for the fields to be displayed and
for the table columns of the selection list, if necessary
types:
begin of lty_stru_input,
add fields for the display of your search input here
WERKS TYPE WERKS,
end of lty_stru_input.
types:
begin of lty_stru_list,
add fields for the selection list here
WERKS TYPE WERKS_D,
NAME1 type NAME1,
end of lty_stru_list.
data: ls_search_input type lty_stru_input,
lt_select_list type standard table of lty_stru_list,
ls_text type wdr_name_value,
lt_label_texts type wdr_name_value_list,
lt_column_texts type wdr_name_value_list,
lv_window_title type string,
lv_group_header type string,
lv_table_header type string,
lv_werks type werks_d.
field-symbols: <ls_query_params> type lty_stru_input,
<ls_selection> type lty_stru_list.
case ovs_callback_object->phase_indicator.
when if_wd_ovs=>co_phase_0. "configuration phase, may be omitted
in this phase you have the possibility to define the texts,
if you do not want to use the defaults (DDIC-texts)
Set label from Medium Description to something more logical...
ls_text-name = `NAME1`. "must match a field in list structure
ls_text-value = `Plant description`.
insert ls_text into table lt_label_texts.
Set col header from Medium Description to something more logical...
ls_text-name = `NAME1`. "must match a field in list structure
ls_text-value = `Plant description`.
insert ls_text into table lt_column_texts.
lv_window_title = wd_assist->get_text( `003` ).
lv_group_header = wd_assist->get_text( `004` ).
lv_table_header = wd_assist->get_text( `005` ).
ovs_callback_object->set_configuration(
label_texts = lt_label_texts
column_texts = lt_column_texts
group_header = lv_group_header
window_title = lv_window_title
table_header = lv_table_header
col_count = 2
row_count = 20 ).
when if_wd_ovs=>co_phase_1. "set search structure and defaults
In this phase you can set the structure and default values
of the search structure. If this phase is omitted, the search
fields will not be displayed, but the selection table is
displayed directly.
Read values of the original context (not necessary, but you
may set these as the defaults). A reference to the context
element is available in the callback object.
ovs_callback_object->context_element->get_static_attributes(
importing static_attributes = ls_search_input ).
pass the values to the OVS component
ovs_callback_object->set_input_structure(
input = ls_search_input ).
*
when if_wd_ovs=>co_phase_2.
If phase 1 is implemented, use the field input for the
selection of the table.
If phase 1 is omitted, use values from your own context.
if ovs_callback_object->query_parameters is not bound.
endif.
assign ovs_callback_object->query_parameters->*
to <ls_query_params>.
if not <ls_query_params> is assigned.
TODO exception handling
endif.
call method ovs_callback_object->context_element->get_attribute
exporting
name = 'WERKS'
importing
value = lv_werks.
data: lv_subcat_text type rstxtmd.
select werks
name1
into table lt_select_list
from T001W.
ovs_callback_object->set_output_table( output = lt_select_list ).
when if_wd_ovs=>co_phase_3.
apply result
if ovs_callback_object->selection is not bound.
endif.
assign ovs_callback_object->selection->* to <ls_selection>.
if <ls_selection> is assigned.
ovs_callback_object->context_element->set_attribute(
name = `WERKS`
value = <ls_selection>-werks ).
endif.
endcase.
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Trond,
In my scenario, If we click on any cell under column (new value), I need to show F4help relevant field name.
Example: if we click on cell under newvalue column then if that relevant field is 'EBELN' then it should show the purchase document numbers .
If we click on some other cell in under newvalue column then if that relevant field is 'BUKRS' then it show the company codes.
This is my requirement. Please advice me how to implement this.
Regards,
BBC
Hi,
In other words, you need a dynamic OVS, that is tied to one column that is not bound to a specific field value.
I believe you should be able to use the generic OVS code (as listed above), and just pass the field name as a parameter (or retrieve it from, say, the assistance class). Your resulting table of select values would have to be generically or dynamically typed, but apart from that, it should work.
I'll try to make a prototype to verify the idea. Will keep you posted...
Hi again,
from what I understand, you need a search help that changes contents based on the field name of the first column. not sure if I got this right, but that's my assumption. So, the first column can be either BUKRS, EBELN, WERKS or a number of other fields. of course, each of these will be related to their own specific value table (T001W for WERKS and so on).
What I would do (at least as long as the number of possible fields is limited) is creating an Automatic search help, then dynamically set the value list for the field to be searched.
Here's a sample method that I just verified in my own test WDA. You have to create this method in your view, then call it from an action of the first column (whenever the user clicks the first column). This way, you can dynamically build the value list based on the field name of the first column.
You'd probably have to create an internal table containing all the possible field names, along with their related value tables (T001W for WERKS etc). This is not mentioned in the logic.
method populate_search_help .
data lo_nd_main type ref to if_wd_context_node.
data lo_el_main type ref to if_wd_context_element.
data ls_main type wd_this->element_main.
data lv_field_name type wd_this->element_main-field_name.
data: lo_node_info type ref to if_wd_context_node_info.
lo_nd_main = wd_context->get_child_node( name = wd_this->wdctx_main ).
lo_el_main = lo_nd_main->get_element( ).
lo_el_main->get_attribute(
exporting
name = `FIELD_NAME`
importing
value = lv_field_name ).
data lv_field type ref to data.
create data lv_field type (lv_field_name).
data: lt_value_table type wdy_key_value_table,
lv_key_value type wdy_key_value.
types: begin of t_selected_values,
field type string,
text type string,
end of t_selected_values.
data: lv_selected_values type t_selected_values,
lt_selected_values type table of t_selected_values.
field-symbols <fs_value> type t_selected_values.
This is where we have to use an internal table containing field names and related value tables,
instead of the hard-coded WERKS and T001W (but this should be fairly simple to do)
select werks name1 from t001w up to 100 rows
into (lv_selected_values-field, lv_selected_values-text).
append lv_selected_values to lt_selected_values.
endselect.
loop at lt_selected_values assigning <fs_value>.
move <fs_value>-field to lv_key_value-key.
move <fs_value>-text to lv_key_value-value.
append lv_key_value to lt_value_table.
endloop.
lo_nd_main = wd_context->path_get_node( path = `MAIN` ).
lo_node_info = lo_nd_main->get_node_info( ).
lo_node_info->set_attribute_value_set(
exporting name = `FIELD_VALUES`
value_set = lt_value_table ).
endmethod.
Hope you can use this. Remember to trigger this method whenever the user selects a field in the first column (represented here by FIELD_NAME).
Note that this is not an OVS. I believe the above method is an easier alternative.
Regards,
Trond
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.