Generating Java Object API Code

Use the Code Generation Utility to generate object API code, which allows you to use APIs to develop device applications for Android devices.

Prerequisites
  • Generate and download the ESDMA bundle for you application.
  • Run the ESDMA Converter utility to turn your ESDMA into an SAP Mobile Platform package.
  • Deploy the package to the SAP Mobile Server.
See Create, Generate, and Download the ESDMA Bundle, Convert the ESDMA Bundle into an SAP Mobile Platform Package, and Deploy the SAP Mobile Platform Package in Mobile Data Models: Using Data Orchestration Engine.
Task
  1. Locate <domain name>_package.jar in your mobile project folder. For the SMP101 example, the project is deployed to the default domain, and the deploy jar file is in the following location: SMP101\Deployment\.pkg.profile\My_SAP_Mobile_Server\default_package.jar.
  2. Make sure that the JAR file contains this file:
    • deployment_unit.xml
  3. From SMP_HOME\MobileSDK23\ObjectAPI\Utils\bin, run the codegen.bat utility, specifying the following parameters:
    codegen -android -client -doe -java -ulj 
    [-output <output_dir>] [-doc] <ESDMA_dir>\META-INF\sup-db.xml
    • The -output parameter allows you to specify an output directory. If you omit this parameter, the output goes into the SMP_HOME\MobileSDK23\ObjectAPI\Utils\genfiles directory, assuming codegen.bat is run from the SMP_HOME\MobileSDK23\ObjectAPI\Utils\bin directory.
    • The -doc parameter specifies that documentation is generated for the generated code.
    Ignore these warnings:
    log4j:WARN No appenders could be found for logger ...
    log4j:WARN Please initialize the log4j system properly.