Generating Java Object API Code

Use the Generate Code wizard to generate object API code for the SMP101 mobile application project. Code generation creates the business logic, attributes, and operations for the mobile business objects (MBOs) in the project.

Prerequisites
Task
  1. In SAP Mobile WorkSpace, open the SMP101 mobile application project.
    In WorkSpace Navigator, right-click the SMP101 folder and select Open in Diagram Editor.
  2. In WorkSpace Navigator, expand SMP101. Under Generated Code, add a folder named Android.

    The Generated Code directory was created during the MBO tutorial.

  3. Right-click anywhere in the SMP101 - Mobile Application Diagram and select Generate Code.
  4. In the Generate Code wizard, click Next to continue without a configuration.
  5. In the Select Mobile Business Objects window, select the Customer MBO, then click Next.
    Ignore any warning about unresolved mobile business object dependencies. The warning appears because you selected the customer data only.
  6. In the Configure options window, specify these values and click Finish.
    Option Description
    Language Select Java.
    Platform Select Android.
    Mobile server Select My Mobile Server (or the server to which you deployed the SMP101 project, if you used another).
    Server domain Select default.
    Page size Select 1024.

    The page size should be larger than the sum of all attribute lengths for any MBO that is included with all the MBOs selected, and must be valid for the database. If the page size is not set, the default page size is 4KB at runtime.

    Package Enter com.mycorp.smp101.android.mbo.

    Bundling groups of related types into packages makes types easier to find and use, avoids naming conflicts, and controls access.

    Project path Enter \SMP101\Generated Code\Android.
    Third-party jar file Click Browse to open an android.jar, by default located in C:\Program Files (x86)\Android\android-sdk\platforms\android-xx.

    This is the Android system library.

    Generate JavaDoc Unselect for this tutorial.

    You are not creating automatic documentation from comments in the code.

    Note: For more about the configuration options, see Developer Guide: Android Object API Applications.


    Android Tutorial Generate Code Window

  7. In the Success dialog, click OK.
    In the Generated Code directory, you see an \Android\src\ folder.