on 02-09-2009 5:59 AM
Hi All,
I want to have OVS help for Matnr field. I have gone through the standard OVS webdynpro but unable to understand. Please give me the code for my requirement with explanation. Your response would be highly rewarded.
Regards
Swapna
Hi Swapna ,
Please find the code below regarding the OVS search help.
1.First of all Create component useage OVS_USAGE for component WDR_OVS in your application component .
2.Create controller use for component WDR_OVS in view.
3.Select input help mode u201EObject Value Selectoru201C and the OVS component usage OVS_USAGE for the context attribute MATNR.
4.Navigate to the methods tab of view and create event handler method ON_OVS for event OVS of component WDR_OVS.
and finally go thru the code mention below.
METHOD on_ovs .
TYPES:
BEGIN OF ty_selfields, "Selection fields
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF ty_selfields,
BEGIN OF ty_sflight, "Columns in the results table
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF ty_sflight.
DATA:
lt_text TYPE wdr_name_value_list, "Label texts
ls_text LIKE LINE OF lt_text, "Label texts
ls_selfields TYPE ty_selfields, "Selection fields
cond(72) TYPE c, "for one where clause
itab_where LIKE TABLE OF cond, "dyn. where clause tabl
lt_sflight TYPE TABLE OF ty_sflight, "Results table
node_flightinfo TYPE REF TO if_wd_context_node, "Reference to context n
elem_flightinfo TYPE REF TO if_wd_context_element. "Reference to context n
FIELD-SYMBOLS:
<query_params> TYPE ty_selfields,
<selection> TYPE ty_sflight.
CASE ovs_callback_object->phase_indicator.
WHEN ovs_callback_object->co_phase_0.
create texts for labels
ls_text-name = 'CARRID'.
ls_text-value = 'Airline Code'.
INSERT ls_text INTO TABLE lt_text.
ls_text-name = 'CONNID'.
ls_text-value = 'Connection Code'.
INSERT ls_text INTO TABLE lt_text.
ls_text-name = 'FLDATE'.
ls_text-value = 'Flight Date'.
INSERT ls_text INTO TABLE lt_text.
set text for window, group, labels and table header
ovs_callback_object->set_configuration(
label_texts = lt_text
group_header = 'Search for a Flight Date'
window_title = 'Value Help'
table_header = 'Flights' ).
WHEN ovs_callback_object->co_phase_1.
navigate from <CONTEXT> to <FLIGHTINFO> via lead selection
node_flightinfo = wd_context->get_child_node( name = `FLIGHTINFO` ).
get element via lead selection
elem_flightinfo = node_flightinfo->get_element( ).
get attributes
elem_flightinfo->get_static_attributes( IMPORTING static_attributes = ls_selfields ).
IF ls_selfields IS INITIAL.
ls_selfields-carrid = 'LH'.
ENDIF.
set selection fields
ovs_callback_object->set_input_structure( input = ls_selfields ).
WHEN ovs_callback_object->co_phase_2.
IF ovs_callback_object->query_parameters IS NOT BOUND.
exception handling
ENDIF.
get query parameters
ASSIGN ovs_callback_object->query_parameters->* TO <query_params>.
create where condition
IF NOT <query_params>-carrid EQ ''.
CONCATENATE 'CARRID = ''' <query_params>-carrid '''' INTO cond.
APPEND cond TO itab_where.
ENDIF.
IF NOT <query_params>-connid EQ '0000'.
CONCATENATE 'CONNID = ''' <query_params>-connid '''' INTO cond.
IF <query_params>-carrid NE ''.
CONCATENATE 'AND' cond INTO cond SEPARATED BY space.
ENDIF.
APPEND cond TO itab_where.
ENDIF.
IF NOT <query_params>-fldate IS INITIAL.
CONCATENATE 'FLDATE = ''' <query_params>-fldate '''' INTO cond.
IF NOT itab_where IS INITIAL.
CONCATENATE 'AND' cond INTO cond SEPARATED BY space.
ENDIF.
APPEND cond TO itab_where.
ENDIF.
get results table
IF itab_where IS NOT INITIAL.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE lt_sflight
WHERE (itab_where).
ELSE.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE lt_sflight.
ENDIF.
set results table
ovs_callback_object->set_output_table( output = lt_sflight ).
WHEN ovs_callback_object->co_phase_3.
IF ovs_callback_object->selection IS NOT BOUND.
TODO exception
ENDIF.
get selection
ASSIGN ovs_callback_object->selection->* TO <selection>.
IF <selection> IS ASSIGNED.
navigate from <CONTEXT> to <FLIGHTINFO> via lead selection
node_flightinfo = wd_context->get_child_node( name = `FLIGHTINFO` ).
get element via lead selection
elem_flightinfo = node_flightinfo->get_element( ).
move selection to context attribute FLDATE
elem_flightinfo->set_static_attributes(
static_attributes = <selection> ).
ENDIF.
ENDCASE.
ENDMETHOD.
I hopes it solves ur problem.
Regards
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swapna,
Please refer to this blog: /people/shruti.rathour/blog/2008/05/05/ovs-help-in-web-dynpro-abap
also refer the standard component WDR_TEST_OVS, in its component controller look for the method ON_OVS, the code for the OVS is given there. It will not be the same as your requirement, so please go through it and try to understand it. Look at the code, you need to write the logic to extract Matnr value in phase 2 (i.e when if_wd_ovs=>co_phase_2), get all the data in l_message_tab and use method set_output_table to display the result.
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swapna,
Where you getting confuse.You no need to debug the standard component.Just try to use the functinality giving by the WDR_OVS.
Follow the steps.
1. Reuse component WDR_OVS in your component.
2. Go to the properties of view where you are implementing ovs for field matnr and click on create controller usage button then add OVS interface controller to view.
3. go to methods of view add eventhandler method and select event OVS from Interface controller.
4. Inside the methos it has 4 phases with descriptions follow accordingly.
Note:
Refer the sample component DEMO_VALUE_HELP
use phase 2 to get the data and add to selection list.
I am giving sample code to your requirement
types:
begin of lty_stru_list,
add fields for the selection list here
column1 type string,
matnr type matnr,
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.
case ovs_callback_object->phase_indicator.
when if_wd_ovs=>co_phase_0. "configuration phase, may be omitted
lv_window_title = 'OVS HELP FOR Material No'. " wd_assist->get_text( `003` ).
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 = 1
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.
TODO exception handling
endif.
assign ovs_callback_object->query_parameters->*
to <ls_query_params>.
if not <ls_query_params> is assigned.
TODO exception handling
endif.
call business logic for a table of possible values
lt_select_list = ???
select matnr
from mara
into table lt_select_list.
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 = `A_MATNR` " Context attribute
value = <ls_selection>-matnr ).
endif.
endcase.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.