on 12-04-2008 5:26 AM
Hi friends,
i have a field City in my layout.. and i m using the Dataelement standard and in the node i gave Automatic search help.
now im getting the F4 help for the city.
But when i hit F4 i can see couple of input fields like city region and desc.. these are filters in F4.
I want to make a default value in F4 help.
how can we do it?
Niraja
Hi Niraja,
If you create an OVS search help then you can default some values to be displayed. You would do this in phase 1 of the OVS. Try go through the phase 1 of the below fragment. In my example I have created an OVS for an input field on my view. The user can enter a MATNR value in here and he can press F4 to search by using wildcard characters for MATNR (material number) & MAKTX (material description). Below are the 2 lines where am defaulting the values to be displayed in phase 1.
" Setting the default values to be displayed in the selection screen
ls_search_input-matnr = 'D'.*
ls_search_input-maktx = ''.*
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
matnr type string,
maktx type string,
end of lty_stru_input.
types:
begin of lty_stru_list,
" add fields for the selection list here
matnr type string,
maktx type string,
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.
field-symbols: <ls_query_params> type lty_stru_input,
<ls_selection> type lty_stru_list.
data: lv_matnr type mara-matnr,
lv_maktx type makt-maktx.
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 don't want to use the defaults (DDIC-texts)
ls_text-name = `MATNR`. "must match a field name of search
ls_text-value = `Material Number`. "wd_assist->get_text( `001` ).
insert ls_text into table lt_label_texts.
ls_text-name = `MAKTX`.
ls_text-value = `Material Description`.
insert ls_text into table lt_label_texts.
ls_text-name = `MATNR`. "must match a field in list structure
ls_text-value = `Col1 -> Material Number`. "wd_assist->get_text( `002` ).
insert ls_text into table lt_column_texts.
ls_text-name = `MAKTX`. "must match a field in list structure
ls_text-value = `Col2 -> Material Description`. "wd_assist->get_text( `002` ).
insert ls_text into table lt_column_texts.
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 ).
" Setting the default values to be displayed in the selection screen
ls_search_input-matnr = 'D*'.
ls_search_input-maktx = '*'.
* 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 ovs_callback_object->query_parameters is not bound.
" TODO exception handling
endif.
assign ovs_callback_object->query_parameters->*
to <ls_query_params>.
lv_matnr = <ls_query_params>-matnr.
lv_maktx = <ls_query_params>-maktx.
replace all occurences of: '*' in lv_matnr with '%',
'*' in lv_maktx with '%'.
select a~matnr
b~maktx into corresponding fields of table lt_select_list up to 10 rows
from mara as a inner join
makt as b on a~matnr = b~matnr where
( a~matnr like lv_matnr and b~maktx like lv_maktx and b~spras = 'EN' ).
if not <ls_query_params> is assigned.
" TODO exception handling
endif.
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.
" TODO exception handling
endif.
assign ovs_callback_object->selection->* to <ls_selection>.
if <ls_selection> is assigned.
ovs_callback_object->context_element->set_attribute(
name = `MATNR`
value = <ls_selection>-MATNR ).
concatenate 'Description from MAKT:'
<ls_selection>-MAKTX
into <ls_selection>-MAKTX separated by space.
ovs_callback_object->context_element->set_attribute(
name = `MAKTX`
value = <ls_selection>-MAKTX ).
endif.
endcase.
endmethod.
Regards,
Uday
Edited by: Uday Gubbala on Dec 4, 2008 11:08 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niraja,
Am sorry but I think that the only way you can achieve the same using a data dictionary search help is by specifying a value in the "Default Value" column of the search help. May be try copy the standard search help into your custom search help & try incorporate the change. You can then specify this search help to be used against your attribute. Hope this helps.
Regards,
Uday
Uday,
Sorry for late reply, I did that and its working for me .
But one thing.. when i hit F4, i can see a default value there. But can i even see the results for that defaulted value in the result result.
I mean when i click search, i m getting result. But when i hit F4, by default i need the value in input field,
also the results for that defaulted value.
can be this possible?
Niraja
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.