Professional Documents
Culture Documents
Working With Tabstrip in Webdynpro For Abap
Working With Tabstrip in Webdynpro For Abap
Applies to:
SAP ECC 6.0 (Release 700, SP 12). For more information, visit the Web Dynpro ABAP homepage..
Summary
This tutorial explains about Step-By-Step procedure for creating a Tabstrip in Webdynpro ABAP. It makes
use of a number of UI elements as well. We will also see how to clear the selection screen context and how
to call a POPUP window.
Author: Anusha Vupalapathi
Company: Intelligroup Asia Pvt Limited
Created on: 8th JUNE 2009
Author Bio
Anusha V is a senior associate consultant currently working for Intelligroup Asia Pvt. Ltd. She is having good
knowledge in SAP ABAP.
Table of Contents
Description .......................................................................................................................................................... 3
Create Webdynpro Component .......................................................................................................................... 4
Creating context in Component Controller ......................................................................................................... 4
Design View ........................................................................................................................................................ 6
Implementation of the methods ........................................................................................................................ 12
Embedding view to window .............................................................................................................................. 13
Create a WebDynpro Application ..................................................................................................................... 15
Output 1: If an entries exits for the selection criteria. ................................................................................................. 15
Related Content ................................................................................................................................................ 18
Disclaimer and Liability Notice .......................................................................................................................... 19
Description
The Tabstrip UI element allows the display of a tab page. The user can toggle between several
tab pages by selecting a specific tab. The same window is shared by all tab pages and used
for displaying the content. The user can display the content of a tab by selecting a tab title.
Scenario:
Button: “SUBMIT”.
Tables in Tabstrip: Displays the list of all flights and Flight schedules in two different tabs
based on the input given by user on Screen. And also displays a popup window with a message
if no flight detail exists with given input.
z Go to transaction SE80.
z Select “Webdynpro Comp. /Intf” from the list.
z Create a new Webdynpro component by the name ZWDA_TABSTRIP.
z In component Controller create the nodes and attributes. We are taking Airline code i.e. CARRID
as input and displaying the list of all flights (SFLIGHT) and Flight schedules (SPFLI) as output. So
create these attributes in the context of component controller. Right click on the context
tab create node.
z For CARRID create node as shown below and select “Add Attribute from structure” and create attribute
to the node. Make sure that the cardinality is 1..1 as it is the input field.
Select the fields you want to display from the table SFLIGHT using “Add attribute from
structure” button.
Similarly create the remaining two nodes SFLIGHT and SPFLI with corresponding attributes. Make the
cardinality as 0..N for these two nodes. Finally the context in the component controller looks like the below
figure.
Design View
z Create a view for the selection. Activate the component at this point of time.
z On the Context Tab, drag the nodes from the Component Controller context and drop it onto the Main
View Context.
z Define the layout of the view. Create a label to the input field. Right click on
ROOTUIELEMENTCONTAINER and insert element as shown below.
z Create the INPUT field and set the Property as shown in the figure. Click on the “value” field and select
the Carrid node from the context Main view. This will be input field for the application.
z Create one Button and if you click this button the flight details will be display in the table.
In button properties give action as SELECTION.
If you give the property as SELECTION, then one event handler will generate for this button
with name ONACTIONSELECTION. In this handler you need to write the code that you want to
execute when ever button is pressed.
z Creation of TABSRIP. To create Tabstrip insert Tabstrip element in your layout, further to
create n no. of tabs, right click on the Tabstrip and insert tab as shown below.
Note: In each tab only one element can be created. The UI Element ‘transparent container’ can be used to have multiple
elements in a single tab.
z We need to add elements to tab separately. In the first tab add a table with Sflight node
details. And in the second tab add a table with Spfli node details.
z After adding table element to the tab, Bind the Table with the corresponding Nodes we
created in the Context Component. The same is shown below.
z Select the context and we get the nodes in the context of the view. Select the Sflight node
and we get the below details.
z After binding the table this is the screen with table values binded with context.
z Similarly create a table and bind the values of “Spfli” node for the second tab. After all it
looks like the below screen.
z Write the code you want to execute in ONACTIONSELECTION method of the Button. Go to
Wizard and select the radio button “READ Context” and insert the nodes names “CARRID”.
Press the OK button. Now the Wizard generates the code to access the node Carrid.
Similarly do for the remaining two nodes i.e. SFLIFGT and SPFLI.
We are reading the context of Node CARRID. Similarly get the nodes of SFLIGHT and
SPFIL from context using via lead selection.
Fetch the data from Sflight and Spfli into tables based on the input field Carrid. See the
below code for more information.
METHOD onactionselection.
* Types declaration
DATA lo_nd_carrid TYPE REF TO if_wd_context_node.
DATA lo_el_carrid TYPE REF TO if_wd_context_element.
DATA ls_carrid TYPE wd_this->element_carrid.
l_cmp_api = wd_comp_controller->wd_get_api( ).
l_window_manager = l_cmp_api->get_window_manager( ).
lv_carrid = ls_carrid-carrid.
CONCATENATE 'No Flights avilable for' lv_carrid INTO text SEPARATED BY ' '.
l_popup = l_window_manager->create_popup_to_confirm(
text = l_text
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_information
window_title = 'Information'
window_position = if_wd_window=>co_center ).
l_popup->open( ).
ENDIF.
IF sy-subrc EQ 0.
* binding the table it_flight
lo_nd_sflight->bind_table( it_flight ).
lo_nd_spfli->bind_table( it_spfli ).
ENDIF.
ENDMETHOD.
Select the value from the search help and click on Display button. Data for selected values will
be displayed in Tabstrip element like below.
Give any Airline code as an input which doesn’t have entries in Sflight and Spfli.
Related Content
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/e8/ac884118aa1709e10000000a155106/content.htm
Web Dynpro ABAP Basic UI Elements
For more information, visit the Web Dynpro Java homepage.