Académique Documents
Professionnel Documents
Culture Documents
Applies to:
Web Dynpro for ABAP. ECC 6.0 onwards. For more information, visit the Web Dynpro ABAP homepage.
Summary
This article shows a step by step procedure for creating and working with radio buttons in a table row. This can help new Web Dynpro ABAP developers in building complex applications. Author Company : : Sreekanth Gollamudi IBM 11 July 2009
Created on :
Author Bio
Sreekanth Gollamudi has around five years of experience which includes in Analysis, Design and Development of complex software applications relating to SAP. He has very good experience in design and development of FRICE objects and strong background in OOABAP, BSP and WebDynpro for ABAP.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Table of Contents
Introduction ........................................................................................................................................................ 3 Creating a component ..................................................................................................................................... 3
Context creation ........................................................................................................................................................... 3 Context population ....................................................................................................................................................... 4 View ............................................................................................................................................................................. 5 Code ............................................................................................................................................................................. 8 New table ..................................................................................................................................................................... 9
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Introduction
We will see how to build an application with radio buttons in a table row and how to get the changed radio button values when an action triggered. Creating a component Create a WebDynpro component with name ZWD_RADIO
Under context node create four attributesName, SelectedKey, Accept and Deny with type as STRING.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Context population Write the below code in WDDOINIT of component controller. Here selectedkey valus is important when we bing the data to a table.
METHOD WDDOINIT . DATA: NODE TYPE REF TO IF_WD_CONTEXT_NODE, IT_DATA TYPE IF_COMPONENTCONTROLLER=>ELEMENTS_RADIO, WA_DATA LIKE LINE OF IT_DATA. WA_DATA-NAME = 'Sachin'. WA_DATA-SELECTEDKEY = 'a'. WA_DATA-ACCEPT = 'X'. WA_DATA-DENY = ''. APPEND WA_DATA TO IT_DATA. WA_DATA-NAME = 'Dravid'. WA_DATA-SELECTEDKEY = 'a'. WA_DATA-ACCEPT = 'X'. WA_DATA-DENY = ''. APPEND WA_DATA TO IT_DATA.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
WA_DATA-NAME = 'Saurav'. WA_DATA-SELECTEDKEY = 'b'. WA_DATA-ACCEPT = ''. WA_DATA-DENY = 'X'. APPEND WA_DATA TO IT_DATA. NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'RADIO' ). NODE->BIND_TABLE( IT_DATA ). ENDMETHOD.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Create 3 columns in a table, and first column as textview, second and thrird columns as radio buttons. -> Bind the table columns with view context. Bind the first column with the name of the view context
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Bind the Second and Third columns selectedKey property with the view contexts SELECTEDKEY.
Note: KeyToSelect should be different in each column and selectedKey should be same and should be binded with same context node. For example, for the first radio button, I am passing keyToSelect as a and next one as b and both are binded to same context node SELECTEDKEY. Depending on the value keyToSelect, we can write the code on some action.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Put a button on the view and create action with name as UPDATE.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
IF WA_RADIO-SELECTEDKEY = 'a'. WA_RADIO-ACCEPT = 'X'. ELSEIF WA_RADIO-SELECTEDKEY = 'b'. WA_RADIO-DENY = 'X'. ENDIF. MODIFY IT_RADIO FROM WA_RADIO INDEX SY-TABIX. ENDLOOP. ITEMS_NODE->BIND_TABLE( IT_RADIO ). ENDMETHOD.
New table Create a new Table UI element on the view and bind - Name, Accept and Deny fields of view context to the table UI element.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Execute Execute the application and by default we will get the below screen
Now change the radio options and click on update button, will gives the below result.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table
Related Content
For more information, visit the Web Dynpro ABAP homepage.
Web Dynpro for ABAP Working with Horizontal Radio Buttons in a Table