Vous êtes sur la page 1sur 19

C Business Function

Overview

Step by Step understanding of writing C

-BSFN
Main Components of C – Business Function

Component

Where Created

Business Function

Specifications

OMW

Business Function Design

Data Structure Specifications

OMW

Data Structure Design Tool

.C file

Generated in Business

Function Design

Modified with the IDE

.H file

Generated in Business

Function Design

Modified with the IDE


Header File Sections

■ Header File Comment

■ Header file name ■ Programmer

■ SAR number

■ Copyright Information

■ Description

■ History

■ Table Header Inclusions

Include statements for header files associated

with tables that are directly accessed by this

business function.

■ External Business

Function Header

Inclusions

Include statements for headers associated

with

externally defined business functions that are

directly accessed by this business function.


■ Global Definitions

Global constants used by the business

function.

■ Structure Type

Definitions

Data structure definitions for internal

processing. (USER DEFINED STRUCTURES)


■ DS Template Type Definition

Data structure type definitions

generated by Business Function

Design.

Symbolic constants for the data

structure generated by Business

Function Design

■ Source Preprocessor

■ Undefines JDEBFRTN if it is

already defined.

■ Checks for how to define

JDEBFRTN.

■ Defines JDEBFRTN.

■ Business Function Prototype

Prototypes for all business functions

in the source file.

■ Internal Function Prototype

Prototypes for all internal functions

that are required to support

business functions
within this source file.
Some Important Points of Header File Section

Structure Definitions

Data structures for passing information

between business functions, internal

Functions, and database APIs.

Source Preprocessor

Definitions

All business function header files contain

this section to ensure that the business

function is prototyped and declared based

on where this header is included.


Data structure type definition. Used to pass

information between an application or

report and a business function. The

programmer places it on the clipboard and

pastes it in the header file. Its components

include:

■ Comment Block, which describes the data

structure.

TYPEDEF for Data Structure

■ Preprocessor Directives, which ensure

that the data type is defined only once.

■ Typedef, which defines the new data type.

■ #define, which contains the ID to be used

in

processing if the related data structure

element is in error.

■ #endif, which ends the definition of the

data

structure type definition and its related

information.
Business Function Standard All business functions

share the same return type and parameter data

types. Only the function name and the data

structure number vary between business

functions.

Parameters include:

JDEBFRTN(ID)

JDEBFWINAPI

CheckForInAddMode

■ LPBHVRCOM : Pointer to a data structure

used for communicating with business functions.

Values include an environment handle.

■ LPVOID

: Pointer to a void data structure.

Currently used for error processing; will be used

for security in the future.

■ LPDS##### : Pointer to a data structure

containing information that is passed between

the business function and the application or

report that invoked it. This number is generated

through Object Librarian.

■ JDEBFRTN(ID)JDEBFWINAPI : All business

functions will be declared with this return type.


Source File Sections

■ Source File Comment

Block

■ Source file name ■ Programmer

■ SAR number

■ Copyright Information

■ Description

■ History ■ Date

■ Notes Comment Block

Any additional relevant notes concerning the

business function source.

Ex: Complex Algorighms.

■ Business Function

Comment Block

I■ Business function name

■ Description

■ Description list of the parameters

■ Business Function
Source

Code

Source code for the business

function.

■ Internal Function

■ Function name

■ Notes

Comment Block & Source ■ Returns

■ Parameters

■ Internal Function Source code

Code
Some Important Points of Source File Section

#include <jde.h>

Includes all base JD Edwards

EnterpriseOne definitions.

#define b98sa001_c

Ensures that related header file

definitions are correctly created for

this source file.

Source File

Verifies the information in the file

comment section. Enter the

programmer's name, SAR number,

and description.

#include <B98SA001.h>

Includes the header file for

this application.

Business Function

Verifies the name and description in


the business function comment

block.
JDEBFRTN(ID)JDEBFWINAPI

CheckForInAddMode (LPBHVRCOM

lpBhvrCom,LPVOID lpVoid,

LPDS104438 lpDS).

Includes the header of a business

function declaration.

Variable declarations

Declares variables that are local to

the business function.

Declare structures

Declares local data structures to

communicate between business

functions, internal functions, and

the database.

Declare pointers

Declares pointers.

Check for NULL pointers

Business Function Standard Verifies


that all communication structures

between an application and the

business function are valid.

jdeErrorSet (lpBhvrCom, lpVoid, (ID) Sets the standard error to be

0, _J("4363"), LPVOID) NULL);

returned to the calling application

return ER_ERROR;

when any of the communication

data

structures are invalid.


Set pointers

Declares and assigns appropriate

values to pointers.

Main Processing

Provides main functionality

for a business function.

Function Clean Up

Frees any dynamically

allocated memory.

Internal function comment

Block

Defines internal functions that

are required to support the

business function. They

should follow the same C

coding standards. A comment

block is required for each

internal function and should

be formatted correctly.
HUSER

HREQUEST

The user handle contains information related

to a specific connection. Each user handle has

an associated environment handle with it. A

connection handle is required to connect to a

data source. If you are using transaction

processing, initializing HUSER indicates the

beginning of a transaction.

The request handle contains information

related to a specific request to a data source.

An application must have a request handle

before executing SQL statements. Each

request handle is associated with a user

handle.

Vous aimerez peut-être aussi