11 Understanding Standard Header and Source Files

This chapter contains the following topics:

11.1 Standard Header

Header files help the compiler properly create a business function. The C language contains 33 keywords. Everything else, such as printf and getchar, is a function. Functions are defined in header files that you include at the beginning of a business function. Without header files, the compiler does not recognize the functions and might return error messages.

This example shows the standard header for a business function source file:

/****************************************************************
 *  Header File: BXXXXXXX.h
 *  Description: Generic Business Function Header File
 *    History:
 *     Date    Programmer SAR# - Description
 *     ---------- ---------- ----------------------------
 *  Author 03/15/2006           - Created
 *
 * Copyright (c) Oracle, 2006
 *
 * This unpublished material is proprietary to Oracle.
 * All rights reserved. The methods and
 * techniques described herein are considered trade secrets
 * and/or confidential. Reproduction or distribution, in whole
 * or in part, is forbidden except by express written permission
 * of Oracle.
 ****************************************************************/
#ifndef __BXXXXXXX_H
#define __BXXXXXXX_H
/***************************************************************
 * Table Header Inclusions
 ***************************************************************/

/**************************************************************
 * External Business Function Header Inclusions
 ***************************************************************/

/**************************************************************
 * Global Definitions
 **************************************************************/

/**************************************************************
 * Structure Definitions
 **************************************************************/

/***************************************************************
 * DS Template Type Definitions
 **************************************************************/

/***************************************************************
 * Source Preprocessor Definitions
 **************************************************************/
#if defined (JDEBFRTN)
   #undef JDEBFRTN
#endif

#if defined (WIN32)
   #if defined (WIN32)
      #define JDEBFRTN(r) __declspec(dllexport) r
   #else
      #define JDEBFRTN(r) __declspec(dllimport) r
   #endif
#else
   #define JDEBFRTN(r) r
#endif
/**************************************************************
 * Business Function Prototypes
 ***************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GenericBusinessFunction
                (LPBHVRCOM     lpBhvrCom,
                 LPVOID        lpVoid,
                 LPDSDXXXXXXXX lpDS);

/**************************************************************
 * Internal Function Prototypes
 **************************************************************/
#endif  /* ___BXXXXXXX_H */

11.1.1 Business Function Name and Description

Use the Business Function Name and Description section to define the name of the business function, describe the business function, and maintain the modification log.

11.1.2 Copyright Notice

The Copyright section contains the Oracle copyright notice and must be included in each source file. Do not change this section.

11.1.3 Header Definition for a Business Function

The Header Definition section for a Business Function contains the "#define" of the business function. It is generated by the tool. Do not change this section.

11.1.4 Table Header Inclusions

The Table Header Inclusions section contains the include statements for the table headers associated with tables directly accessed by the business function.

See Lowercase Letters in Include Statements.

11.1.5 External Business Function Header Inclusions

The External Business Function Header Inclusions section contains the include statements for the business function headers associated with externally defined business functions that are directly accessed by the business function.

See Lowercase Letters in Include Statements.

11.1.6 Global Definitions

Use the Global Definitions section to define global constants used by the business function. Enter names in uppercase, separated by an underscore.

See Using Define Statements.

11.1.7 Structure Definitions

Define structures used by the business function in the Structure Definitions section. Structure names should be prefixed by the Source File Name to prevent conflicts with structures of the same name in other business functions.

See Understanding Naming ConventionsUsing Typedef Statements.

11.1.8 DS Template Type Definitions

The DS Template Type Definitions section defines the business functions contained in the source that correspond to the header. You generate the structure from the business function or data structure design window in Object Management Workbench. After you generate the structure, copy and paste it into this section.

11.1.9 Source Preprocessing Definitions

The Source Preprocessing Definitions section defines the entry point of the business function and includes the opening bracket required by C functions. Do not change this section.

11.1.10 Business Function Prototypes

Use the Business Function Prototypes section to prototype the functions defined in the source file.

See Creating Function Prototypes.

11.1.11 Internal Function Prototypes

The Internal Function Prototypes section contains a description and parameters of the function.

See Understanding Naming ConventionsCreating Function Prototypes.

11.2 Standard Source

The source file contains instructions for the business function. These sections describe the sections of a standard source file.

A template generated for a standard source file when you create a JD Edwards EnterpriseOne business function appears in the following pages:

#include <jde.h>
#define bxxxxxxx_c
/***************************************************************
 *  Source File: bxxxxxxx
 *
 *  Description: Generic Business Function Source File
 *
 *    History:
 *     Date    Programmer SAR# - Description
 *    -------------------------------------------------------
 *  Author 06/06/2005           - Created
 *
 * Copyright (c) Oracle, 2005
 *
 * This unpublished material is proprietary to Oracle.
 * All rights reserved. The methods and techniques described
 * herein are considered trade secrets and/or confidential.
 * Reproduction or distribution, in whole or in part, is
 * forbidden except by express written permission of
 * Oracle.
 **************************************************************/
/**************************************************************
 * Notes:
 *
 **************************************************************/

#include <bxxxxxxx.h>
/*************************************************************
 * Global Definitions

**************************************************************/

/*************************************************************
 * Business Function: GenericBusinessFunction
 *
 *   Description: Generic Business Function
 *
 *   Parameters:
 *   LPBHVRCOM  lpBhvrCom Business Function Communications
 *   LPVOID    lpVoid  Void Parameter - DO NOT USE!
 *   LPDSDXXXXXXX lpDS   Parameter Data Structure Pointer
 *
 *************************************************************/
JDEBFRTN (ID) JDEBFWINAPI GenericBusinessFunction
                 (LPBHVRCOM     lpBhvrCom,
                  LPVOID        lpVoid,
                  LPDSDXXXXXXXX lpDS)
{
 /***********************************************************
  * Variable declarations
  ***********************************************************/

 /***********************************************************
  * Declare structures
  ***********************************************************/

 /***********************************************************
  * Declare pointers
  ***********************************************************/

 /***********************************************************
  * Check for NULL pointers
  ***********************************************************/
 if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
     (lPVoid  == (LPVOID)  NULL) ||
     (lpDS   == (LPDSDXXXXXXXX) NULL))
 {
    jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0,
                 4363, (LPVOID) NULL);
    return ER_ERROR;
 }
 /***********************************************************
  * Set pointers
  ***********************************************************/

/***********************************************************
  * Main Processing
  ***********************************************************/

 /***********************************************************
  * Function Clean Up
  ***********************************************************/

 return (ER_SUCCESS);
}
/* Internal function comment block */
/**************************************************************
 *  Function: Ixxxxxxx_a // Replace xxxxxxx with source file
 *             // number
 *             // and a with the function name
 *   Notes:
 *
 *  Returns:
 *
 * Parameters:
************************************************************/

11.2.1 Business Function Name and Description

Use this section to maintain the name and description of the business function. Also use this section to maintain the modification log.

11.2.2 Copyright Notice

The Copyright section contains the Oracle copyright notice and must be included in each source file. Do not make any changes to this section.

11.2.3 Notes

Use the Notes section to include information for anyone who might review the code in the future. For example, describe any peculiarities associated with the business function or any special logic.

11.2.4 Global Definitions

Use the Global Definitions section to define global constants used by the business function.

See Initializing Variables.

11.2.5 Header File for Associated Business Function

In the Header File for Associated Business Function section, include the header file associated with the business function using #include. If you need to include additional header files in the source, place them here.

11.2.6 Business Function Header

The Business Function Header section contains a description of each of the parameters used by the business function. Do not make any changes to this section.

11.2.7 Variable Declarations

The Variable Declarations section defines all required function variables. For ease of use, define the variables sequentially by type.

See Understanding Naming ConventionsInitializing Variables.

11.2.8 Declare Structures

Define any structures that are required by the function in the Declare Structures section.

See Creating Function Prototypes.

11.2.9 Pointers

If any pointers are required by the function, define them in the Pointers section. Name the pointer so that it reflects the structure to which it is pointing. For example, lpDS1100 is pointing to the structure DS1100.

11.2.10 Check for NULL Pointers

The Check for NULL Pointers section checks for parameter pointers that are NULL. Do not change this section.

11.2.11 Set Pointers

Use the Set Pointers section if you did not initialize the variables when declaring them. You must assign values to all pointers that you define.

See Creating Function Prototypes.

11.2.12 Main Processing

Use the Main Processing section to write the code.

11.2.13 Function Clean Up

Use the Function Clean Up section to release any allocated memory.

See Using the Function Clean Up Area.

11.2.14 Internal Function Comment Block

The Internal Function Comment Block section contains a description and parameters of the function.

See Understanding Naming Conventions.