Use the Code Generation Utility to generate object API code containing
mobile business object (MBO) references. This method of generating code allows you to
automate the process of code generation, for example through the use of scripts.
Prerequisites
- Use SAP Mobile WorkSpace to develop and package your mobile business
objects. See SAP Mobile WorkSpace - Mobile Business Object Development > Develop > Developing a Mobile Business Object.
- Deploy the package to the SAP Mobile Server,
creating files required for code generation from the command line. See SAP Mobile WorkSpace - Mobile Business Object Development > Develop > Packaging and Deploying Mobile Business Objects
>Automated Deployment of SAP Mobile WorkSpace Projects.
Task- 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.
- Make sure that the JAR file contains this file:
- Use a utility to extract the deployment_unit.xml file to another location.
- From SMP_HOME\MobileSDK23\ObjectAPI\Utils\bin, run the codegen.bat utility, specifying the following
parameters:
codegen.bat -oc -client -ul -mdp deployment_unit.xml [-output <output_dir>][-pageSize <page_size_in_bytes>] [-doc]
- 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\genfiles
directory.
- The -doc parameter specifies that documentation is generated for the generated code.
- The case sensitive -pageSize parameter is optional and
specifies the page size generated in the client code. Valid values are
1024, 2048, 4096, 8192, and 16384.
Ignore these warnings:
log4j:WARN No appenders could be found for logger ...
log4j:WARN Please initialize the log4j system properly.