Show TOC

Procedure documentationProgramming User Messages Locate this document in the navigation structure

 

User Messages are messages that are displayed on the mobile device depending on the user action performed.

Prerequisites

You have created:

Procedure

  1. Double-click the Message Pool node.

    Alternatively, press F3, or, in the Message Pool context menu, choose Open.

  2. In the Resource Text tab page, click Add to add a new resource.

  3. In the New Resource dialog window, choose errorMessage as the Resource Type.

  4. Enter a Resource Name.

    Use an ID for the exception, such as InvalidEmployeeNameException.

  5. Enter a Text.

    Use a text targeted for the user, such as Employee Name is not valid!

    The created resource appears in the table of the *<<Service Component>>.xlf tab page.

  6. Save your data.

    Note Note

    By using the message pool, you can ensure internationalization of your application.

    More information: Internationalization of Web Dynpro Projects

    End of the note.
  7. Create an instance of the exception in the custom operation.

    More information:   http://help.sap.com/javadocs/   Mobile 7.1   Mobile Applications for Handhelds   com.sap.tc.mobile.wdlite.ocaexceptions   OCAException  

  8. Provide logging and user notification details in the controller implementation of the UI Component.

    More information:

Example

Creating an Instance of the Exception

Syntax Syntax

  1. //Creating an instance for the exception InvalidEmployeeNameException and display the message on the mobile device
    //@@begin implementation
    	if ((arg0.getName() == null) || (arg0.getName().length() == 0)) {
    		throw new InvalidEmployeeNameException("INVALID_EMPLOYEE_NAME_ID",
    			WDLite.getApplicationDCName(),
    			new String[] {"null"}, IOCAException.ERROR);
    	} 
    //@@end
    
End of the code.
Logging and Raising Exception Messages

Syntax Syntax

  1. //Use the Exception Handler class to log and raise the exception message 
    public void saveNewEmployee() {
    //@@begin saveNewEmployee()
    	 		try {
    				EmployeeSdoEmployee arg0 = (EmployeeSdoEmployee) wdContext
    							.nodeNewEmployee().getCurrentElement().model();
    				service.checkEmployee(arg0);
    				root.commit();
    				refreshEmployeeList();
    			} catch (InvalidEmployeeNameException e) {
    				// To be displayed on CFS RT Container UI 
    				WDLite.getExceptionHandler().logAndRaiseMessage(e);
    			}
    
End of the code.