Create an Object Skeleton Subprogram

This section describes the Object Skeleton code generator, which creates a skeleton subprogram. The following topics are covered:


Generate the Object Skeleton Subprogram

Start of instruction setTo generate an object skeleton subprogram

  1. Open the context menu in the Navigator view for the NaturalONE project into which you want to generate the module.

    Or:
    Open the context menu in the Navigator view for the library into which you want to generate the module.

  2. Select Code Generation > New Object Skeleton.

    The Define Object Skeleton Details panel is displayed. For example:

    graphics/define-object-skeleton-details.png

  3. Type the location of the Natural library in which to generate the subprogram and associated modules in Library.

    The library must currently exist.

    Or:
    Select Browse to display a window listing the existing libraries for selection.

    Note:
    The libraries listed for selection are based on the current project.

  4. Type the name of the subprogram in Name.

    Using this panel, you can:

    Task Procedure
    Select another NaturalONE project in which to generate the subprogram. Type the name of the project in Project or select Browse to display a window listing the existing projects for selection. The project must currently exist.
    Select a folder in which to generate the subprogram. Type the name of the folder in Folder or select Browse to display a window listing the existing folders for selection. The folder must currently exist within the selected NaturalONE project.

    Note:
    This option allows you to generate modules into more complex library structures (for example, "Natural-Libraries/my library (MYLIB)/SRC"). When this option is not specified, modules will be generated into the basic library folder (for example, "Natural-Libraries/MYLIB/SRC", "Natural-Libraries/MYLIB/Subprograms", etc.).

    Change or provide a description of the subprogram. Type a brief description in Description.
  5. Select Next.

    The Enter the Subprogram Parameters panel is displayed. For example:

    graphics/enter-subprogram-parameters.png

    Use this panel to define input/output and state parameters for the subprogram to be generated.

  6. Type the parameters for your subprogram in Subprogram parameters.

  7. Select Finish to generate the subprogram with the DEFAULT method.

    Or:
    Select Next to define other methods.

    The Enter the Subprogram Methods panel is displayed. For example:

    graphics/enter-subprogram-parameters.png

    This panel displays the default methods for the subprogram to be generated. Using this panel, you can:

    Task Procedure
    Add a method to the subprogram. For information, see Add a Method.
    Remove a method from the subprogram. Select the method in the Method list and select Remove.
  8. Select Finish.

    When generation is complete, the available user exits are displayed in the Outline view (see User Exits for the Object Skeleton Subprogram.) and the generated modules are displayed in the Navigator view. For example:

    graphics/object-skeleton-example-in-navigator.png

    The subprogram is displayed in the editor view. For example:

    graphics/object-skeleton-example-in-editor.png

  9. Save the subprogram.

    At this point, you can:

    • Define user exits for the subprogram. For information, see Defining User Exits.

    • Use the NaturalONE Testing option to test the subprogram. For information, see Test a Subprogram Directly in Application Testing.

    • Use NaturalONE functionality to upload the generated subprogram to the server.

Add a Method

Start of instruction setTo add a method to the subprogram

  1. Select Add.

    The Method details section is displayed. For example:

    graphics/enter-subprogram-methods-add-method.png

    By default, method1 is displayed in the Method section.

  2. Type the name of the new method in Name.

  3. Type a brief description of the method in Description.

User Exits for the Object Skeleton Subprogram

The Outline view for the object skeleton subprogram displays the available user exits. For example:

graphics/user-exits-in-outline-view-object-skeleton.png

You can use these exits to define additional processing.

Notes:

  1. All user exits are empty when generated.
  2. For information about adding custom code within user exits, see Defining User Exits.