Escolar Documentos
Profissional Documentos
Cultura Documentos
in Select Option
Applies to:
SAP Net Weaver Web Dynpro for ABAP. For more information, visit the Web Dynpro ABAP homepage.
Summary
This tutorial provides a step-by-step guide for using OVS search help functionality in Select Option in a WDA
application. This tutorial assumes that have a good understanding of the basics of Web Dynpro for ABAP.
Author:
Chinnaiya Pandian
Author Bio
Chinnaiya Pandian is working for HCL AXON. He is Computer Science Graduate and working
on Technologies like ABAP, Web Dynpro ABAP, Floor Plan Manager & SAP Interactive forms,.
Table of Contents
Creating the Web Dynpro for ABAP (WDA) Object ............................................................................................ 3
Define Used Components................................................................................................................................... 4
Creating a View .................................................................................................................................................. 4
Creating Context ................................................................................................................................................. 5
Creating Layout .................................................................................................................................................. 6
Defining Attributes .............................................................................................................................................. 8
Method Implementation ...................................................................................................................................... 9
Creating Event Handler Method For OVS in Select Option .............................................................................. 10
Embed View into Window ................................................................................................................................. 12
Create the Application ...................................................................................................................................... 13
Testing the Application ..................................................................................................................................... 14
Related Content ................................................................................................................................................ 16
Disclaimer and Liability Notice .......................................................................................................................... 17
Enter the Description for your Component and Save it as Local object [$TMP]
Creating a View
Create a view by right clicking on the object name and choose Create->View. Give the view name as "MAIN"
and a description. Click on the properties tab of the view. In the "Used Controllers/Components" tab, click the
create icon. Add the two components for Select_Options.
Creating Context
Click on the Context tab of the view. Create a node called "P0002". Set the Cardinality as 0..N. Next create
the attributes by right clicking on the node and choosing Create Using the Wizard->Attributes from
Components of Structure. Enter PA0002 as the structure to be copied. Select all fields except MANDT and
hit enter. The Context should now look like this.
Choose the fields from the Displayed structure. The Node should now look like this.
Creating Layout
Now create the layout for the Component.
UI elements need to be created
View container to place the Select option
Button
Table
Create Button UI element & create an action for the button with the name vact_ongetdetail
Defining Attributes
Click on the Attributes tab of the view. Add the following attributes as seen here are required for the select
option
Method Implementation
Click on the Methods tab of the view. Double click on the WDDOINIT method. Add the code as you see here
METHOD wddoinit .
).
ENDMETHOD.
Click on the Methods List button. Double click on the ONACTIONVACT_ONGETDETAIL method. Add the
code as you see here.
METHOD onactionvact_ongetdetail .
DATA:
DATA:
DATA:
DATA:
i_id = 'EMP_ID' ).
ASSIGN rt_p0002->* TO <fs_pernr>.
CLEAR ls_p0002.
REFRESH lt_p0002[].
SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_p0002 FROM pa0002
WHERE pernr IN <fs_pernr>.
node_p0002 = wd_context->get_child_node( name = `NODE_P0002` ).
node_p0002->bind_table( lt_p0002 ).
ENDMETHOD.
Double click on the ON_OVS_IN_SO method. Add the code as you see here
METHOD on_ovs_in_so .
TYPES : BEGIN OF ty_pernr,
pernr TYPE persno ,
vorna TYPE pad_vorna,
nachn TYPE pad_nachn,
END OF ty_pernr.
LIKE lt_pernr,
<p0002>
LIKE LINE OF <lt_ovs_result>,
<lt_sel_opt_result> TYPE STANDARD TABLE.
CASE i_ovs_data-m_ovs_callback_object->phase_indicator.
WHEN if_wd_ovs=>co_phase_0.
i_ovs_data-m_ovs_callback_object->set_configuration(
col_count = 2 table_multi_select = abap_true ).
WHEN if_wd_ovs=>co_phase_1.
**
i_ovs_data-m_ovs_callback_object->set_input_structure( input
WHEN if_wd_ovs=>co_phase_2.
= P0002 ).
SELECT pernr
vorna
nachn INTO CORRESPONDING FIELDS OF TABLE lt_pernr
FROM pa0002 UP TO 10 ROWS.
i_ovs_data-m_ovs_callback_object->set_output_table( output =
WHEN if_wd_ovs=>co_phase_3.
lt_pernr
).
After pressing the help for the personnel Number the below help table will be display
Press the get detail button to display the records for selected employee numbers
Related Content
http://forums.sdn.sap.com/thread.jspa?threadID=1513448
Wiki for webdynpro ABAP
For more information, visit the Web Dynpro ABAP homepage