!--a11y-->
Creating a Warning Message and Implementing
onActionRent()
If the user of the example application chooses Rent without first specifying a vehicle type, an appropriate warning message must appear. You save this warning message in the message pool.
If the user has selected a vehicle type, ResultView displays the vehicle type.
...
1. Open the message pool of LanguagesComp (choose LanguagesComp ® Message Pool)
2.
Add a new message
by choosing
.
3. Under Message Key, enter NoCar. Under Message Type, enter warning. Under Message Text, enter Please choose a vehicle type, and choose OK.

4. Save the current status of the metadata.
1. Open FormView and switch to the Implementation tab page.
2. Add the following source code to the method onActionRent():
onActionRent() |
public void onActionRent(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) { //@@begin onActionBook(ServerEvent) String vehicleType = wdContext.currentContextElement() .getVehicleType(); //if no vehicleType was choosen if (vehicleType == null){ MessageManager msg = (MessageManager) wdComponentAPI .getMessageManager(); msg.reportMessage(IMessageLanguagesComp.NO_CAR, null, false); } //if a vehicleType was choose – show ResultView else{ wdThis.wdFirePlugOutRent(vehicleType); } //@@end } |

You no longer need to make the imports required to display the message, since they have already been defined in the project template.
Creating Dynamic Texts and Completing the Application
