This chapter contains the following topics:
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 */
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.
The Copyright section contains the Oracle copyright notice and must be included in each source file. Do not change this section.
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.
The Table Header Inclusions section contains the include statements for the table headers associated with tables directly accessed by the business function.
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.
Use the Global Definitions section to define global constants used by the business function. Enter names in uppercase, separated by an underscore.
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.
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.
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.
Use the Business Function Prototypes section to prototype the functions defined in the source file.
The Internal Function Prototypes section contains a description and parameters of the function.
See Understanding Naming ConventionsCreating Function Prototypes.
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: ************************************************************/
Use this section to maintain the name and description of the business function. Also use this section to maintain the modification log.
The Copyright section contains the Oracle copyright notice and must be included in each source file. Do not make any changes to this section.
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.
Use the Global Definitions section to define global constants used by the 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.
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.
The Variable Declarations section defines all required function variables. For ease of use, define the variables sequentially by type.
Define any structures that are required by the function in the Declare Structures section.
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.
The Check for NULL Pointers section checks for parameter pointers that are NULL. Do not change this section.
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.
Use the Main Processing section to write the code.
Use the Function Clean Up section to release any allocated memory.
The Internal Function Comment Block section contains a description and parameters of the function.