Show TOC Start of Content Area

Procedure documentation Implementing Application Service Operations  Locate the document in its SAP Library 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 findByIdmethod, 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 getAllmethos, 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();

   }

       6.      Click on the code implementation with the secondary mouse buttona nd choose Source Organize Imports.

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.

End of Content Area