Sei sulla pagina 1di 18

Step 1: Create a webdynpro component as shown below. Enter the component name and press enter.

Assign the component to a package.

Step 2: In the Context node of the iew controller! create a context node "A#I$ of cardinality %..n and attrib&tes to it as shown below.

Create an attrib&te for the node "A#I$.

Step ' : (o to the layo&t of the iew controller and place the )I element "adio b&tton gro&p by index.

*ind the texts property of the radio b&tton to o&r attrib&te.

Step +: ,ow go to the -##$I,I. method to initiali/e the al&e for the radio b&ttons. 0et &s ass&me we are gonna pro ide colors red! bl&e and green as a option for the radio b&tton.

1&st set the context node along with yo&r al&es to it.

"ead the context node &sing code wi/ard. Select the icon and choose the context node. Select the radio b&tton set and click the check box as table operation to set the node as a table.

Codes will be generated as below.

,ow create a work area for the internal table generated by the code wi/ard. 2ard code the al&es to the work area and append the al&es to the internal table.

Sa e and acti ate yo&r whole component. Step 3: Create an application to test yo&r component.

.est yo&r application.

$&tp&t:

So far we ha e only seen to set the radio b&ttons on the screen. ,ow let &s see the action associated with the radio b&tton on dynamically changing the b&ttons on the screen.

Step 4: Create a context attrib&te text of type string as shown below in the iew controller.

Step 5: (o to the layo&t of the iew controller and inset a )I element 0abel.

In the property of the lable )I element fill in the obligatory parameters marked with red.

*ind the lable for property to the text iew which we are going to create now. Step 6: Create a )I element text iew.

*ind the property of the text iew 7.E8.9 to the attrib&te text which we created earlier.

Assign the text iew as the lable for property of the label. Step : : In the properties of the "adio b&tton )I element create an action.

#o&ble click on the action $n toggle and write the following codings.

"ead the context node &sing the code wi/ard. ;,ote : ,ot as table operation < . Code will be generated as below.

#eclare an attrib&te for index and get the radio b&tton selected &sing the method get=lead=selection=index. ,ow we ha e got the index n&mber of which is being selected. .o identify the al&e which is selected read the context node as a table operation and read the selected al&e &sing the index which we obtained. #elete already declared ariables from the genreated code >eep the code below.

,ow the internal table contains all the records from which we can choose the selected one &sing "ead statement with the index.

.hen (et the al&e of which radio b&tton is selected and set the attrib&te 7text9 to indicate which radio b&tton has been selected. )sing code wi/ard set the attrib&te text as shown below.

Sa e and acti ate the whole component and test the application. $&tp&t:

Potrebbero piacerti anche