Show TOC

Implementing Application Service OperationsLocate this document in the navigation structure

Use

You need to implement the query methods you have created in the previous step of this tutorial.

Procedure
  1. Save and generate your application.
  2. Open the Implementation tab page of the TravelLocationApp application service.
  3. To open java editor, choose TravelLocationAppBeanImpl.java.
  4. In the findById method, delete the generated instruction return null; and add the following code:
    public com.sap.demo.carpool.modeled.TravelLocation findById(java.lang.Long id)
    throws com.sap.caf.rt.exception.CAFServiceException {
       
    return getTravelLocationService().
    
              findById(QueryFilterFactory.createFilter(id)).
    
                                                           iterator().next();
    
       }  
     
  5. In the getAll methos, delete the generated instruction return null; and add the following code:
    public java.util.List<com.sap.demo.carpool.modeled.TravelLocation> getAll()
    throws com.sap.caf.rt.exception.CAFServiceException 
       return getTravelLocationService().findAll();  
          }
Result

You have implemented your application service operations. Now you need to generate, build and deploy your application. The operations just delegate the call to a business object node operation. In a real application, you may put some pre and postprocessing with custom Java code.

More Information: Generating Code and Building Services .