| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
OVS help in the WebDynpro application (WebDynpro for ABAP)21. Double Click the Method ON_OVS and write the Following
Coding. 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
job_id type string,
job_desc type string,
end of lty_stru_input.
types:
begin of lty_stru_list,
* add fields for the selection list here
short type short_d,
stext type stext,
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_short TYPE string,
lv_stext TYPE string.
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) ls_text-name = `JOB_ID`. "must match a field name of search
ls_text-value = `Job Abbr`.
INSERT ls_text INTO TABLE lt_label_texts.
ls_text-name = `JOB_DESC`. "must match a field name of search
ls_text-value = `Job Description`.
INSERT ls_text INTO TABLE lt_label_texts.
ls_text-name = `SHORT`.
ls_text-value = `Job Abbr`.
INSERT ls_text INTO TABLE lt_column_texts.
ls_text-name = `STEXT`.
ls_text-value = `Job Description`.
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 = 'Job Abbreviation'
col_count = 2
row_count = 10 ).
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 = ??? lv_short = <ls_query_params>-job_id.
lv_stext = <ls_query_params>-job_desc.
REPLACE ALL OCCURRENCES OF '*' IN lv_short WITH '%' .
REPLACE ALL OCCURRENCES OF '*' IN lv_stext WITH '%' .
IF lv_short NE ' ' AND lv_stext NE ' '. SELECT short stext FROM hrp1000 INTO TABLE lt_select_list
WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
endda GE sy-datum AND ( short LIKE lv_short AND
stext LIKE lv_stext )
ORDER BY short ASCENDING.
ELSEIF lv_short EQ ' ' AND lv_stext NE ' '. SELECT short stext FROM hrp1000 INTO TABLE lt_select_list
WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
endda GE sy-datum AND stext LIKE lv_stext
ORDER BY short ASCENDING.
ELSEIF lv_short NE ' ' AND lv_stext EQ ' '. SELECT short stext FROM hrp1000 INTO TABLE lt_select_list
WHERE plvar = '01' AND otype = 'C' AND langu = 'EN' AND
endda GE sy-datum AND short LIKE lv_short
ORDER BY short ASCENDING.
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 = `JOB_ID`
value = <ls_selection>-short ).
ovs_callback_object->context_element->set_attribute(
name = `JOB_DESC`
value = <ls_selection>-stext ).
endif. endcase. endmethod.
22. Save the Application and Activate the Component.
23. Create Webdynpro Application, save it and
Test the Application. Output:
1. Press F4 in the Field Job Id. It will open a Pop-up.
2. Enter the Value with ‘*’ and Click on Start Search
Button. It will display all the possible Entries corresponding to that
Selection. If you want Exact Selection then no need to give ‘*’.
3. On selecting one of the Job Abbr and Clicking the Ok
Button, the Job Id and its Description will be displayed in the Screen as
follows.
|
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||