Entering content frame

Procedure documentation 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.

 

Procedure

Creating a Warning Message

...

       1.      Open the message pool of LanguagesComp (choose LanguagesComp ® Message Pool)

       2.      Add a new message by choosing This graphic is explained in the accompanying text.

       3.      Under Message Key, enter NoCar. Under Message Type, enter warning. Under Message Text, enter Please choose a vehicle type, and choose OK.

This graphic is explained in the accompanying text

       4.      Save the current status of the metadata.

 

Implementation of the Method onActionRent()

 

       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

}

This graphic is explained in the accompanying text

You no longer need to make the imports required to display the message, since they have already been defined in the project template.

 

Next step:

Creating Dynamic Texts and Completing the Application

 

 

Leaving content frame