Professional Documents
Culture Documents
This exercise shows how to dynamically set visibility property of a button using Web Dynpro ABAP. Based on the user logged in, need to set the visibility invisibility of button. !f the logged in user is "e#uester$say Developer%&', he should be able to submit the re#uest with details entered. !n this case, button Submit has to be visible. And if the logged in user is approver$say Developer%(', he should be able to Approve the details. And so Approve button has to be visible. The development includes creation of an WebDynpro component, with a view which will be reused for both "e#uester and Approver. The view consists of an input field and two buttons. And view context with attributes for logged in user, visibility for re#uester and approver. Based on the user logged, the re#uired button has to be made visible, by setting the value of context attributes accordingly. Procedure: Create component. )o toTrasaction code *+,%. *elect Web Dynpro -omp. !ntf. As ob.ect type. +nter the name of the component as /D+012B3TT1425!*!B6+.
-lic7 on 8+*.!n the Pop displayed, enter the Description for componetn and Window 4ame.
And save as local ob.ect or in a pac7age. The component will be created and its structure shown as below.
Create view. "ight clic7 on the component name on the tree structure /D+012B3TT1425!*!B6+9:-reate9:5iew, as shown below.
+nter the 5iew 4ame and Description as shown below. And press enter.*ave the view, so it appears in the comoponent structure. Double clic7 on view name. Create context. -lic7 on -ontext of view and -reate the following Attributes of Types as below screen;
Attribute - Purpose 3ser 9 <or 6ogged in 3ser "e#25isible 9 <or 5isibility of "e#uester button Apprv25isi 9 <or 5isibility of Approver button ser attribute
-lic7 on 6ayout tab of view. !nsert 3! elements 6abel, Text5iew, and two buttons$one for "e#uester and the other for Approver'. "ight clic7 "11T3!+6+0+4"-14TA!4+"9:!nsert +lement.
!nsert 6abel.
Then set the properties of the = 3! elements as below. & 'lement Properties 6abel ; 6abel for, Text Text5iew ; Text $thru context binding' Button> ; Text, 5isible$thru context binding' Button& ; Text, 5isible$thru context binding' 6abel> Properties 6abel<or and Text
'mbed the view into window. Double clic7 on Window name on right side componet structure to show its details.
Drag and drop the view $ from right side ' on to the window name $on left side'. 1r right clic7 on window name$on right side window' and say embed view. Save and Activate the component. Create (eb$ynpro application. "igth clic7 WD component /D+012B3TT1425!*!B6+9:-reate9:Web Dynpro Application. +nter the description in the following pop up displayed. Save the application. Test the Application as shown below.
Test "esult: *ay log in user is Developer%&, the following view displayed with "e#uester button.
*ay log in user is Developer%(, the following view displayed with Approver button.