Professional Documents
Culture Documents
Working With Tabstrip WDA
Working With Tabstrip WDA
Working With Tabstrip WDA
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: Company: Created on: Anusha Vupalapathi Intelligroup Asia Pvt Limited 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
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: To create a Webdynpro application with a Tab strip. UI Elements on the output screen: Parameter: Airline Code: SFLIGHT-CARRID 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. Snap Shot of output Screen:
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
Create a view for the selection. Activate the component at this point of time. On the Context Tab, drag the nodes from the Component Controller context and drop it onto the Main View Context.
Define the layout of the view. Create a label to the input field. Right click on ROOTUIELEMENTCONTAINER and insert element as shown below.
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.
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.
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.
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.
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.
Select the context and we get the nodes in the context of the view. Select the Sflight node and we get the below details.
After binding the table this is the screen with table values binded with context.
Similarly create a table and bind the values of Spfli node for the second tab. After all it looks like the below screen.
lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ). * navigate from <CONTEXT> to <SPFLI> via lead selection lo_nd_spfli = wd_context->get_child_node( name = wd_this->wdctx_spfli ). *Fetch Flight details CLEAR text. SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE it_flight WHERE carrid = ls_carrid-carrid. IF sy-subrc = 0. SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE it_spfli WHERE carrid = ls_carrid-carrid. ELSE. *Display a popup window with an error message if the data does not exist DATA: l_cmp_api TYPE REF TO if_wd_component, l_window_manager TYPE REF TO if_wd_window_manager, l_popup TYPE REF TO if_wd_window, l_text TYPE string_table, l_api TYPE REF TO if_wd_view_controller, message TYPE string. 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 ' '. APPEND text TO l_text. 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( ). *Clear the selection screen. DATA: l_node TYPE REF TO if_wd_context_node. l_node = wd_context->get_child_node( 'CARRID' ). l_node->invalidate( ). 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.
Output 1: If an entries exits for the selection criteria. Select the value from the search help and click on Display button. Data for selected values will be displayed in Tabstrip element like below. Values in the first tab Sflight Details.
OUTPUT 2: If there doesnt exits entries for the selection criteria. Give any Airline code as an input which doesnt 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.