Using Business Functions

This chapter provides an overview of business functions (BSFNs) and transaction master business functions, and discusses how to:

Click to jump to parent topicUnderstanding Business Functions

You can use business functions to enhance JD Edwards EnterpriseOne applications by grouping related business logic. Journal Entry Transactions, Calculating Depreciation, and Sales Order Transactions are examples of business functions.

You can create business functions using one of these methods:

After you create business functions, you can attach them to JD Edwards EnterpriseOne applications to provide additional power, flexibility, and control. You can attach tables and functions to a business function. You must add related tables and functions to the business function object to generate the code for the source and header files. Because the source code for NERs is generated into C, you use the same procedures for debugging both C and NERs.

This section discusses:

Click to jump to top of pageClick to jump to parent topicComponents of a Business Function

The process of creating a business function produces several components. The Object Management Workbench (OMW) is the entry point for the tools that create the components. These components are created:

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

The DLLs are divided into categories. This distribution provides better separation between the major functional groups, such as tools, financials, manufacturing, distribution, and so on. Most business functions are organized into a consolidated DLL based on their system code. For example, a financials business function with system code 01 belongs in CFIN.DLL.

Follow these guidelines when you add or modify business functions:

This table lists some of the DLLs for which Business Function Builder manages the builds:

DLL Name

Functional Group

CAEC

Architecture

CALLBSFN

Consolidate BSFN Library

CBUSPART

Business Partner

CCONVERT

Conversion Business Functions

CCORE

Core Business Functions

CCRIN

Cross Industry Application

CDBASE

Tools - Database

CDDICT

Tools - Data Dictionary

CDESIGN

Design Business Functions

CDIST

Distribution

CFIN

Financials

CHRM

Human Resources

CINSTALL

Tools Install

CINV

Inventory

CLOC

Localization

CLOG

Logistics Functions

CMFG

Manufacturing

CMFG1

Manufacturing - Modification BFs

CMFGBASE

Manufacturing Base Functions

COBJLIB

Tools - Object Librarian

COBLIB

Busbuild Functions

COPBASE

Distribution/Logistic Base Functions

CRES

Resource Scheduling

CRUNTIME

Tools - Run Time

CSALES

Sales Order

CTOOL

Tools - Design Tools

CTRAN

Transportation

CTRANS

Tools - Translations

CWARE

Warehouse

CWRKFLOW

Tools - Workflow

JDBTRG1

Table Trigger Library 1

JDBTRG2

Table Trigger Library 2

JDBTRG3

Table Trigger Library 3

JDBTRG4

Table Trigger Library 4

JDBTRIG

Parent DLL for Database Triggers

Note. Do not use table triggers for regular business functions.

Click to jump to top of pageClick to jump to parent topicHow Distributed Business Functions Work

OMW manages these three main components that make up NERs or business functions:

When a business function is called, the Object Configuration Manager (OCM) determines where to run the business function. After the system maps a business function to a server, calls from that business function cannot be mapped back to the workstation.

This flowchart illustrates how distributed business functions work:

Distributed business function

Click to jump to top of pageClick to jump to parent topicC Business Functions

JD Edwards EnterpriseOne software contains two types of business functions: NERs and C business functions. C business functions are written in C programming language and are used to perform functions that are not available in NERs. C business functions include both a header file (.h) and a source file (.c).

Header File Sections

This table describes the major sections of a business function header file:

Section

What It Includes

Description and Guidelines

Header File Comment

  • Header file name

  • Description

  • History

  • Programmer

  • SAR number

  • Copyright information

Comments that the input process of the Business Function Source Librarian builds.

The programmer name and SAR number are manually updated by the programmer.

Table Header Inclusions

Include statements for header files associated with tables that are directly accessed by this business function.

Table header files include definitions for the fields in a table and the ID of the table itself.

External Business Function Header Inclusions

Include statements for headers associated with externally defined business functions that are directly accessed by this business function.

External function calls with jdeCallObject are included to use the predefined data structures.

Global Definitions

Global constants used by the business function.

Use global definitions sparingly. They include symbolic names that you enter in uppercase; words are separated by an underscore character.

Structure Type Definitions

Data structure definitions for internal processing.

To prevent naming conflicts, define this structure using structure names that are prefixed by the source file name.

DS Template Type Definition

Data structure type definitions generated by Business Function Design.

Symbolic constants for the data structure generated by Business Function Design.

Modify this structure through OMW.

Source Preprocessor

  • Undefines JDEBFRTN if it is already defined.

  • Checks for how to define JDEBFRTN.

  • Defines JDEBFRTN.

Ensures that the business function declaration and prototype are properly defined for the environment and source file, including this header.

Business Function Prototype

Prototypes for all business functions in the source file.

Defines the business functions in the source file, the parameters that are passed to them, and the type of value that they return.

Internal Function Prototype

Prototypes for all internal functions that are required to support business functions within this source file.

Defines the internal functions that are associated with the business functions in the source file, the parameters that are passed to each internal function, and the type of value that they return.

Example: Business Function Header File

Assume that Business Function Design created this header file. This file contains only the required components in a business function header file:

Header File Begin /***************************************************************************** * Header File: B99TEST.h * * Description: test Header File * * History: * Date Programmer SAR# - Description * ---------- ---------- ------------------------------------------ * Author 10/14/2003 DEMO Unknown - Created * * * Copyright (c) 1994 Oracle 2003 * * 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 __B99TEST_H #define __B99TEST_H /***************************************************************************** * Table Header Inclusions ****************************************************************************/ /***************************************************************************** * External Business Function Header Inclusions ****************************************************************************/ /***************************************************************************** * Global Definitions ****************************************************************************/ /***************************************************************************** * Structure Definitions ****************************************************************************/ /***************************************************************************** * DS Template Type Definitions ****************************************************************************/ /***************************************** * TYPEDEF for Data Structure * Template Name: Test Data Structure * Template ID: D59TEST * Generated: Tue Oct 14 16:53:08 2003 * * DO NOT EDIT THE FOLLOWING TYPEDEF * To make modifications, use the EnterpriseOne Data Structure * Tool to Generate a revised version, and paste from * the clipboard. * **************************************/ #ifndef DATASTRUCTURE_D59TEST #define DATASTRUCTURE_D59TEST typedef struct tagDSD59TEST { JCHAR cEverestEventPoint01; JCHAR szNameAlpha[41]; MATH_NUMERIC mnAmountField; } DSD59TEST, *LPDSD59TEST; #define IDERRcEverestEventPoint01_1 1L #define IDERRszNameAlpha_2 2L #define IDERRmnAmountField_3 3L #endif /***************************************************************************** * 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 F0101Test (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD0100018 lpDS); /***************************************************************************** * Internal Function Prototypes ****************************************************************************/ #endif /* __B99TEST_H */ Header File End

This table describes the contents of the various lines in the header file:

Header File Line

Where Input

Description

Header File

OMW

Verify the name of the business function header file.

Description

OMW

Verify the description.

History

IDE

Manually update the modification log with the programmer name and the appropriate SAR number.

#ifndef

Business Function Design

Symbolic constant prevents the contents from being included multiple times.

Table Header Inclusion

Business Function Design

When business functions access tables, related tables are input and Business Function Design generates an include statement for the table header file.

External Business Function Header Inclusions

Business Function Design

No external business functions for this application.

Global Definitions

IDE

Constants and definitions for the business function. It is not recommended that you use this block. Global variables are not recommended. Global definitions go in .c not .h.

Structure Definitions

IDE

Data structures for passing information between business functions, internal functions, and database APIs.

TYPEDEF for Data Structure

Business Function Design

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.

  • 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.

Source Preprocessor Definitions

Business Function Design

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.

Business Function Prototype

Business Function Design

Used for prototypes of the business function.

JDEBFRTN(ID) JDEBFWINAPI CheckForInAddMode

Business Function Design

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:

  • 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. It ensures that they are exported and imported properly.

Parameter names (lpBhvrCom, lpVoid, and lpDS) will be the same for all business functions.

Internal Function Prototypes

Business Function Design

Internal function prototypes required to support the business functions in this source file.

Source File Sections

OMW builds a template for the business function source file. The business function source file consists of several major sections, as described in this table:

Section

What It Includes

Description

Source File Comment Block

  • Source file name

  • Description

  • History

  • Programmer

  • Date

  • SAR Number

  • Description

  • Copyright information

Built from the information in the Business Function Design Tool.

The programmer manually updates the programmer name and SAR number.

Notes Comment Block

Any additional relevant notes concerning the business function source.

Document complex algorithms used, how the business functions in the source relate to each other, and so on.

Business Function Comment Block

  • Business function name

  • Description

  • Description list of the parameters

 

Business Function Source Code

Source code for the business function.

 

Internal Function Comment Block

  • Function name

  • Notes

  • Returns

  • Parameters

Copy these blocks and place the values in the specified sections to describe the internal function. Follow the comment block with internal function source code.

Internal Function Source Code

Source code for the internal function described in the comment block.

The business function developer enters this code as needed. A populated internal function comment block must precede this code.

Example: Business Function Source File

Assume that Business Function Design created this source file called Check for In Add Mode. It contains the minimum components required in a business function source file. The source code in the Main Processing section is entered manually, and varies from business function to business function. All other components are generated by Business Function Design.

#include <jde.h> #define b98sa001_c /***************************************************************************** * Source File: B98SA001.c * * Description: Check for In Add Mode Source File ****************************************************************************/ **************************************************************************/ #include <b98sa001.h> /************************************************************************** * Business Function: CheckForInAddMode * * Description: Check for In Add Mode * * Parameters: * LPBHVRCOM lpBhvrCom Business Function Communications * LPVOID lpVoid Void Parameter - DO NOT USE! * LPDSD98SA0011 lpDS Parameter Data Structure Pointer * *************************************************************************/ JDEBFRTN(ID) JDEBFWINAPI CheckForInAddMode (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD98SA0011 lpDS) { /************************************************************************ * Variable declarations ************************************************************************/ /************************************************************************ * Declare structures ************************************************************************/ /************************************************************************ * Declare pointers ************************************************************************/ /************************************************************************ * Check for NULL pointers ************************************************************************/ if ((lpBhvrCom == NULL) || (lpVoid == NULL) || (lpDS == NULL)) { jdeSetGBRError (lpBhvrCom, lpVoid, (ID) 0, _J("4363")); return CONTINUE_GBR; } /************************************************************************ * Set pointers ************************************************************************/ /************************************************************************ * Main Processing ************************************************************************/ if (lpBhvrCom->iBobMode == BOB_MODE_ADD) { lpDS->cEverestEventPoint01 = _J('1'); } else { lpDS->cEverestEventPoint01 = _J('0'); } return (BHVR_SUCCESS); } /* Internal function comment block */ /************************************************************************** * Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number * // and "a" with the function name * Notes: * * Returns: * * Parameters: **************************************************************************/

The lines that appear in the source file are described in this table:

Source File Line

Where Input

Description and Guidelines

#include <jde.h>

Business Function Design

Includes all base JD Edwards EnterpriseOne definitions.

#define b98sa001_c

Business Function Design

Ensures that related header file definitions are correctly created for this source file.

Source File

OMW

Verifies the information in the file comment section. Enter the programmer's name, SAR number, and description.

#include <B98SA001.h>

OMW

Includes the header file for this application.

Business Function

Business Function Design

Verifies the name and description in the business function comment block.

JDEBFRTN(ID) JDEBFWINAPI CheckForInAddMode (LPBHVRCOM lpBhvrCom, LPVOID lpVoid,

LPDS104438 lpDS)

Business Function Design

Includes the header of a business function declaration.

Variable declarations

IDE

Declares variables that are local to the business function.

Declare structures

IDE

Declares local data structures to communicate between business functions, internal functions, and the database.

Declare pointers

IDE

Declares pointers.

Check for NULL pointers

Business Function Design

Business Function Standard

Verifies that all communication structures between an application and the business function are valid.

jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), LPVOID) NULL);

return ER_ERROR;

Business Function Design

Sets the standard error to be returned to the calling application when any of the communication data structures are invalid.

Set pointers

IDE

Declares and assigns appropriate values to pointers.

Main Processing

IDE

Provides main functionality for a business function.

Function Clean Up

IDE

Frees any dynamically allocated memory.

Internal function comment block

IDE

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.

Use the MATH_NUMERIC data type exclusively to represent all numeric values in JD Edwards EnterpriseOne software. The values of all numeric fields on a form or batch process are communicated to business functions in the form of pointers to MATH_NUMERIC data structures. MATH_NUMERIC is used as a data dictionary (DD) data type.

Click to jump to top of pageClick to jump to parent topicBusiness Function Event Rules

A NER is a business function object for which the source language is event rules instead of C. You create a NER using the event rules scripting language. This scripting language is platform-independent and is stored in a database as a JD Edwards EnterpriseOne software object. NERs are modular. That is, they can be reused in multiple places by multiple programs. This modularity reduces rework and enables you to reuse code.

Not all chunks of code should be packaged in a business function module. For example, when code is so specific that it applies only to a particular program, and it is not reused by any other programs, you should leave it in one place instead of packaging it in a business function. You can attach all the logic on a hidden control (Button Clicked event) and use a system function to process the logic as needed.

An example of a NER is N3201030. This business function creates generic text and Work Order detail records (for the F4802 table) for a configured work order. Based on the structure of the sales order in the F3296 table, the configured segments for the item on the passed work order and all lower level segments are included in the generic text.

This example illustrates the function as it appears in Event Rules Design:

Named Event Rule Begin // // Convert the related sales order number into a math numeric. If that fails // exit the function // String, Convert String to Numeric If VA evt_cErrorCode is equal to "1" // // Validate that the work order item is a configured item. // F4102 Get Item Manufacturing Information If VA evt_cStockingType is not equal to "C" And BF cSsuppressErrorMessages is not equal to "1" BF szErrorMessageID = "3743" Else BF szErrorMessageID = " " // // Delete all existing "A" records from F4802 for this work order. // VA evt_cWODetailRecordType = "A" F4802.Delete F4802.Close // // Get the segment delimiter from configurator constants. // F3293 Get Configurator Constant Row If VA evt_cSegmentDelimiter is less than or equal to <Blank> VA evt_cSegmentDelimiter - / End If // F3296.Open F3296.Select If SV File_IO_Status is equal to CO SUCCESS F3296.FetchNext // // Retrieve the F3296 record of the work order item. and determine its key // sequence by parsing ATSQ looking for the last occurrence of "1". The substring // of ATSQ to this point becomes the key for finding the lower level configured // strings // If VA evt_mnCurrentSOLine is equal to BF mnRelatedSalesOrderLineNumber // Get the corresponding record from F32943. Process the results of that fetch // through B3200600 to add the parent work order configuration to the work order // generic text. F32943.FetchSingle If SV File_IO_Status is equal to CO SUCCESS VA evt_szConfiguredString = concat([VA evt_ConfiguredStringSegment01], [VA evt_ConfiguredStringSegment02]) Confg String Format Segments Cache End If // // Find the last level in ATSQ that is not "00". Note that the first three // characters represent the SO Line Number to the left of the decimal. Example: // SO Line 13.001 will have the ATSQ characters "013". Each configured item can have // 99 lower-level P-Rule items and a total of ten levels. Therefore every pair // thereafter is tested. // VA evt_mnSequencePosition - 1 While VA evt_mnSequencePosition is less than "23" And VA evt_szCharacterPair is not equal to "00" VA evt_mnSequencePosition - [VA evt_mnSequencePosition] + 2 VA evt_szCharacterPair = substr([VA evt_szTempATSQ],[VA evt_mnSequencePostion],2) End While VA evt_szParentATSQ = substr([VA evt_szTempATSQ],0,[VA evt_mnSequencePosition]) // // For each record in F3296 for the related sales order, find those with the same // key substring of ATSQ. Retrieve the associated record from F32943 if // available and pass the configured string to N3200600 for addition to the work // order generic text. // F3296.FetchNext Wile SV File_IO_Status is equal to CO SUCCESS VA evt_szChildATSQ = substr([VA evt_szTempATSQ],0,[VA evt_mnSequencePosition]} If VA evt_szChildATSQ is equal to VA evt_szParentATSQ F32943.FetchSingle If SV File_IO_Status is equal to CO SUCCESS VA evt_szCongifuredString = concat([VA evt_ConfiguredStringSegment01], [VA evt_ConfiguredStringSegment02]) Confg String Format Segments Cache End If End If F3296.FetchNext End Whil F32943.Close // // Unload segments cache into the work order generic text. B3200600 Mode 6 Confg String Format Segments Cache // End If End If F3296.Close // End If Else // The related sales order number is invalid. Return an error. If BF cSuppressErrorMessages is not equal to "1" Set NER Error ("0002", BF SzRelatedSalesOrderNumber) End If End Ir Named Event Rule End

Click to jump to parent topicUnderstanding Transaction Master Business Functions

Transaction master business functions provide a common set of functions that contain all of the necessary default values and editing for a transaction table in which records depend on each other. Transaction master business functions contain logic that ensures the integrity of the transaction being inserted, updated, or deleted from the database. Event flow breaks up logic. You use cache APIs to store records that are being processed. You should consider using a transaction master business function in these situations:

These transaction tables are examples of candidates for transaction master business functions:

A master business function (MBF) can be called from several different applications. Rather than duplicating the processing options for the MBF on each application, you typically create a separate processing option template for these processing options. You can use interactive versions to set up different versions of the MBF processing options. Various calling programs then pass the version name to the version parameter of BeginDoc.

From within BeginDoc, the business function AllocatePOVersionData can be called to retrieve the processing options by version name. The processing options needed by other modules can be written to the header cache and accessed later, rather than calling AllocatePOVersionData multiple times.

The cache structure stores all lines of the transaction. Transaction lines are written to the cache after they have been edited. The EndDoc module then reads the cache to update the database.

This table describes the components of the header section:

Field Description

Field

Key

Type

Size

Job Number

JOBS

X

Num

 

Document Action

ACTN

 

Char

1

Processing Options

       

Currency Flag

CYCR

 

Char

1

Business View Fields

       

Work Fields

       

This table explains the fields:

Field Description

Purpose

Job Number

A unique system-assigned number assigned when the BeginDoc module starts the job. This distinguishes transactions in the cache for each job on the workstation that is using the cache. Use next number 00/4 for the job number. If you are using a unique cache name (D xxxxxxxxx [job number]), you do not necessarily need the job number field stored in the cache for a key because you would only be working with one transaction per cache. You can, therefore, use any field as the key to the cache.

Document Action

The action for the document. Values are:

  • A or 1 = Add

  • C or 2 = Change

  • D = Delete

Processing Options

Processing option values were read in using AllocatePOVersionData, and are needed in other modules of the MBF.

Currency Flag

A system value that indicates whether currency is on and what method of currency conversion is used (N, Y, or Z).

Business View Fields

The fields required for processing the transaction and writing it to the database. All fields in the record format that are not saved in the header cache will be initialized when the record is added to the database using the APIs.

Work Fields

Fields that are not part of the business view (BV), but are needed for editing and updating the transaction.

For example, Last Line Number is the last line number written to the detail cache. It will be stored at the header level, and retrieved and incremented by the MBF. The incremented line number will be passed to the header cache and stored for the next transaction.

This table describes the components of the detail section:

Field Description

Field

Key

Type

Size

Job Number

JOBS

X

Char

8

Line Number

(Application-specific)

X

Num

 

Line Action

ACTN

 

Char

1

Business View Fields

       

Work Fields

       

This table explains the fields:

Field Description

Purpose

Job Number

A unique number assigned when the BeginDoc module starts the job. This distinguishes transactions in the cache for each job on the client that is using the cache. If you are using a unique cache name (D xxxxxxxxx[job number]), you do not necessarily need to store the job number field in the cache for a key because you work with only one transaction per cache. You can, therefore, use line number only as the key to the cache.

Line Number

The number used to uniquely identify lines in the detail cache. This line number can also eventually be assigned to the transaction when it is written to the database. The transaction lines are written to the detail cache only if they are error-free.

Line Action

The action for the transaction line. Values are:

  • A or 1 = Add

  • C or 2 = Change

  • D = Delete

Business View Fields

Fields required for processing the transaction that will be written to the database. All fields in the record format that are not saved in the detail cache will be initialized when the record is added to database using the APIs.

Work Fields

Fields that are not part of the business view, but are needed for editing and updating the transaction line.

Click to jump to parent topicBuilding Transaction Master Business Functions

This section provides an overview of building transaction master business functions, and discusses the component used to build such a business function:

Click to jump to top of pageClick to jump to parent topicUnderstanding Building Transaction Master Business Functions

These flowcharts illustrate how transaction master business functions are built.

First, you create the individual business functions using several basic components:

Building transaction master business functions

Next, you combine the business functions into a DLL:

Combining business functions into a .DLL

You typically use these basic components to create a master business function as described by this table:

Component

Purpose

Begin Document

Called when all header information has been entered. Creates initial header if it has not already been created. Can also include default values, editing, and processing options (POs).

Edit Line

Called when all line information has been entered. Creates cache for detail information if it has not already been created.

Edit Document

Called when ready to commit the transaction. Processes any remaining document edits and verifies that all records are valid to commit.

End Document

Called when you need to commit the transaction. Processes all records in the header and detail cache, performs I/O, and deletes caches.

Clear Cache

Called when you are ready to delete all cache records. Deletes header and detail cache records.

Click to jump to top of pageClick to jump to parent topicBegin Document

Begin Document has this format:

FxxxxxBeginDocument

The Begin Document component performs these tasks:

Special Logic or Processing Required

On the initial call, the function assigns the job number. To retrieve the job number, this function calls X0010GetNextNumber with a system code of 00 and an index number of 04. If called again, Begin Document passes the job number that was previously assigned; therefore, it does not need to assign another job number.

Hook Up Tips

Keep these tips in mind when calling Begin Document:

Common Parameters

This table describes the common parameters for Begin Document:

Name

Alias

I/O

Description

Job Number

JOBS

I/O

Pass Job Number created in Begin Document, if previously called; otherwise, pass zeros and assign a job number.

Document Action

ACTN

I

A or 1 = Add

C or 2 = Change

D = Delete

This is the action of the entire Document, not the individual detail lines. For example, you might modify a few detail lines in Edit Line, add a few detail lines in Edit Line, and delete a few detail lines in Edit Line, but the Document Action in Begin Document would be Change.

Process Edits

EV01

I

Optional

0 = No Edits

Any Other = Full Edits

Note. The GUI interface usually uses the partial edit, and the batch interface uses the full edit. If you leave this parameter blank, the default option is full edits.

ErrorConditions

EV02

O

Blank = No Errors

1 = Warning

2 = Error

Version

VERS

I

This field is required if this MBF is using versions.

Header Field One

****

I/O

Pass in all the header fields that are common to the entire document. Begin Document processes all of these fields and validates them, data dictionary edits, UDC editing, default values, and so on. Begin document might also fetch to the table to validate that records matching these header fields exist for Delete and Change, or do not exist for Add.

Header Field Two

****

I/O

 

.

.

.

****

I/O

 

Header Field XX

****

I/O

 

Work Field / Processing Flag One

****

I

List any work fields that the program needs. These could be flags for processing, dates to validate, and so on. These fields might or might not be used. For example, currency control might be saved in the header cache so that all detail records would either use currency or not.

Work Field / Processing Flag One

****

I

 

.

.

.

 

I

 

Work Field / Processing Flag One

 

I

 

Application-Specific Parameters

Application-specific parameters must perform these tasks:

Click to jump to top of pageClick to jump to parent topicEdit Line

Edit Line has this format:

FxxxxxEditLine

The Edit Line component performs these tasks:

Special Logic or Processing Required

Depending on the type of document being processed, different editing and inserting of default values takes place. An example would be vouchers and invoices processed through the journal entry MBF. The tax calculator is only called for vouchers. Depending on the event processing required, the process edit flag determines the editing that occurs. For example, in an interactive program, when the Grid Record is Fetched event runs, Partial Edits might be performed to retrieve descriptions, default values, and so on. When the Row is Exited and Changed event runs, Full Edits might be performed to validate all user input.

Typical Uses and Hookup

In interactive applications, Edit Line is typically called on Grid Record is Fetched or Row is Exited and Change (Asynch). In batch applications, Edit Line is typically called in the Do section of the group, columnar, or tabular section.

Common Parameters

This table describes the common parameters for Edit Line:

Name

Alias

I/O

Description

Job Number

JOBS

I

Used as key or to create a unique name for the cache or work file. Retrieved from Begin Document.

Line Number

LNID

I/O

The unique number identifying the transaction line. Can also be used as the line number in the Detail Cache.

Line Action

ACTN

I

A or 1 = Add

C or 2 = Change

D or 3 = Delete

Process Edits (optional)

EV01

I

0 = No Edits

1 = Full Edits

2 = Partial Edits

Note. GUI interface typically uses the partial edit, and the batch interface typically uses the full edit. If you leave this parameter blank, the default edit is Full.

Error Conditions

ERRC

O

0 = No Errors

1 = Warning

2 = Error

Update Or Write to Work File

EV02

I

1 = Write or update records to the work file, or do both.

Record Written to Work File

EV03

I/O

1 = A record is written to the work file. This reduces I/O calls to the work file.

Blank = No record is written to the work file.

Detail Field One

****

I/O

Pass in all the Detail fields that will be edited. Typically, these are the grid record fields. Edit Line provides validation, data dictionary edits, UDC editing, default values, and so on.

Detail Field Two

****

I/O

 

Detail Field XX

****

I/O

 

Work Field / Processing Flag One

****

I

List any work fields that the program needs. These fields could be flags for processing, dates to validate, and so on.

Work Field / Processing Flag One

****

I

 

Work Field / Processing Flag One

****

I

 

Click to jump to top of pageClick to jump to parent topicEdit Document

The Edit Document component performs these tasks:

Special Logic or Processing Required

Depending on the type of document that you are processing, different logic is executed. For example, vouchers and invoices are processed through the journal entry edit object, although the balancing is different for these document types.

Hook Up Tips

Edit Document is typically used in this fashion:

Common Parameters

This table describes the common parameters for Edit Document:

Name

Alias

I/O

Description

Job Number

JOBS

I

Retrieved from Begin Document

ErrorConditions

EV01

O

Blank = No Errors

1 = Warning

2 = Error

Application-Specific Parameters

Because all records have been added in Begin Document or Edit Line, and because any information needed to process the entire document is in cache, few parameters are needed in this function.

Click to jump to top of pageClick to jump to parent topicEnd Document

End Document has this format:

FxxxxxEndDocument

The End Document component performs these tasks:

Hook-Up Tips

This function is typically called on OK button Post Button Clicked, and it is hooked up Asynch. In the C code, after the insert or update to the database is successful, call Clear Cache to clear the cache.

Common Parameters

This table describes the common parameters for End Document:

Name

Alias

I/O

Description

Job Number

JOBS

I

Retrieved from Begin Document

Computer ID

CTID

I

Retrieved from GetAuditInfo(B9800100) in application (optional)

Error Conditions

EV01

O

Blank = No errors

1 = Warning

2 = Error

Program ID

PID

I

Usually hard-coded

Application-Specific Parameters

Use application-specific parameters in End Document to perform these tasks:

Click to jump to top of pageClick to jump to parent topicClear Cache

Clear Cache has this format:

FxxxxxClearCache

The Clear Cache component removes the records from the header and detail cache.

Special Logic or Processing Required

If a unique cache name is selected as the naming convention for the cache (Dxxxxxxxx[Job Number]), then use the cache API jdeCacheTerminateAll to destroy the cache.

Common Parameters

This table describes the common parameters for Clear Cache:

Name

Alias

I/O

Description

Job Number

JOBS

I

Indicates the job number of the transaction that you want to clear. This job number should have been returned from BeginDoc.

Clear Header

EV01

I

Indicates whether the header cache should be cleared.

1 = clear cache

Clear Detail

EV02

I

Indicates whether the detail cache should be cleared

1 = clear cache

Line Number From (Optional)

LNID

I

Indicates where to begin clearing records in the detail cache. If this line is blank, the system begins clearing from the first record.

Line Number Thru (Optional)

NLIN

I

Indicates where to stop clearing records in the detail cache. If this line is blank, the system deletes to the end of the cache.

Click to jump to top of pageClick to jump to parent topicCancel Document

Cancel Document has this format:

FxxxxxxCancelDoc

The optional Cancel Document component is used primarily with the Cancel button to close files, clear the cache, and so on. Cancel Document is an application-specific function that provides basic function cleanup.

Special Logic or Processing Required

This function is application-specific.

Common Parameter

This table describes the common parameter for Cancel Document:

Name

Alias

I/O

Description

Job Number

JOBS

I

The job number of the transaction that you want to clear. This number should have been returned from BeginDoc.

Click to jump to parent topicImplementing Transaction Master Business Functions

This section discusses using single-record processing and document processing to implement transaction master business functions.

Click to jump to top of pageClick to jump to parent topicSingle-Record Processing

This section provides an interactive and a batch program flow example for single-record processing.

Interactive Program Flow Example

This is an example of an implementing transaction master business functions during single-record processing in an interactive application:

  1. Post Dialog is Initialized (optional)

    Call Begin Document.

  2. Set Focus on Grid

  3. Row is Exited and Changed or Row is Exited and Changed ASYNC

    Call Edit Line.

  4. Delete Grid Record Verify- After

    Call Edit Line to perform delete for one record.

    Call Edit Document to perform deletes on a group of records.

  5. OK Button Clicked

    Call Begin Doc.

    Call Edit Document.

  6. OK Post Button Clicked

    Call End Document.

Master Business Functions usually perform all table I/O for the given table. Therefore, these actions must be disabled:

Batch Program Flow Example

This is an example of an implementing transaction master business functions during single-record processing in a batch application:

  1. Do Section of Report Header.

    Call Begin Document.

  2. Do Section of the Group Section.

    Call Edit Line.

  3. Do Section of a Conditional Section (optional).

    Call Edit Document.

  4. Do Section of Report Footer.

    Call End Document.

Click to jump to top of pageClick to jump to parent topicDocument Processing

This section provides an interactive program flow example for document processing.

Program Flow Example

This is an example of an implementing transaction master business functions during document processing in an interactive application:

  1. Dialog is Initialized

    Call Open Batch Edit Object module.

  2. Grid is Entered

    Call Begin Document Edit Object module.

  3. Row is Exited

    Call Edit Line Edit Object module.

  4. OK Button Clicked

    Call Edit Document Edit Object module.

  5. Before Add from Database or Before Delete from Database

    Suppress Add/Delete.

    Call End Document Edit Object module.

  6. Cancel Button Clicked

    Call Close Batch Edit Object module.

Click to jump to parent topicWorking with Master File Master Business Functions

Master business functions (MBFs) enable calling programs to process certain predefined transactions. An MBF encapsulates the required logic, enforces data integrity, and insulates the calling programs from the database structures. Use MBFs for these reasons:

MBFs are typically used for multiline business transactions such as journal entries or purchase orders. However, certain master files also require MBF support due to their complexity, importance, or maintenance requirements from external parties. The requirements for maintaining master files are different from those for multiline business transactions.

Generally, master file MBFs are much simpler than multiline business transaction MBFs. Transaction MBFs are specific to a program, while master file MBFs access a table multiple times.

For interoperability, master file MBFs can be used instead of table I/O. This enables you to perform updates to related tables using the business function instead of table event rules. Multiple records are not used; instead, all edits and actions are performed with one call.

In their basic form, master file MBFs have these characteristics:

Characteristic

Description

Single call

Generally, you can make one call to an MBF to edit, add, update, or delete a master file record. An edit-only option is available also.

Single data structure

The fields required to make the request and provide all the necessary values are in one data structure. The data fields should correspond directly with columns in the associated master file.

No cache

Because each master file record is independent of the others, caching is unnecessary. The information provided with each call and the current condition of the database provides all of the information that the MBF needs to perform the requested function.

Normal error handling

As with other MBFs, master file MBFs must be capable of executing both in interactive and batch environments. Therefore, the calling program must determine the delivery mechanism of the errors.

Inquiry feature

To enable external systems to be insulated from the JD Edwards EnterpriseOne database, an inquiry option is included. This enables an external system to use the same interface to access descriptive information about a master file key as it uses to maintain it.

Effect on applications

For JD Edwards EnterpriseOne applications, the effect of implementing a master file MBF should be minimal. Consider and follow several standards before implementing a master file MBF.

Master file applications use the system to process all I/O for find/browse forms. This enables you to use all of the search capabilities of the software.

You should design all master file applications so that all fix/inspect forms are independent of each other. Each fix/inspect form can use the system to fetch the record, and all edits and updates occur using the master file MBF. This independent design has these major benefits:

Certain circumstances might justify deviation from this simple model. These circumstances are:

Click to jump to top of pageClick to jump to parent topicMBF Information Structure

This section discusses the parameters of the MBF information structure.

Standard Parameters for Single-Record Master Business Functions

This table describes the standard parameters for single-record MBFs:

Name

Alias

I/O

Required/Optional

Description

Action Code

ACTN

I

Required

A = Add.

I = Inquiry.

C = Change.

D = Delete.

S = Same as except (the record is the same except for what the user changes).

Update Master File

EV01

I

Optional

0 = No update; edit only (default).

1 = Update performed.

Process Edits

EV02

I

Optional

1 = All Edits (default).

2 = Partial Edits (no data dictionary (DD)).

Suppress Error Messages

SUPPS

I

Optional

1 = Error messages are suppressed.

0 = Process errors normally (default).

Error Message ID

DTAI

O

Optional

Returns error code.

Version

VERS

I

Future

The default value is XJDE0001.

Application-Specific Control Parameters (Example: Address Book)

This table describes the application-specific parameters for Address Book:

Name

Alias

I/O

Required/Optional

Description

Address Book Number

AN8

I/O

Optional

For additions, AN8 is optional. For all other action codes, this parameter is required.

Same as except

AN8

I

Optional

Required for S = Action Code. The record is the same except for what the user changes.

Application Parameters (Example: Address Book)

This table describes the application parameters for Address Book:

Name

Alias

I/O

Required/Optional

Alpha Name

ALPH

I/O

Required

Long Address Number

ALKY

I/O

Optional

Search Type

AT1

I

Required

Mailing Name

MLMN

I

Required

Address Line 1

ADD1

I

Optional

City

CTY1

I

Optional

State

ADDS

I

Optional

Postal Code

ADDZ

I

Optional

Click to jump to top of pageClick to jump to parent topicMaster Business Function Impact on Performance

Performance issues might occur regardless of how you handle large-format tables. Two options for improving performance are:

Through different interfaces, the user can add additional data later. Most processes dictate that part of the data be added immediately, while related data can be added later. For example, the user might define a customer master record but wait until a later date to define the customer's billing instructions. Therefore, you should select the first option of splitting MBFs so that one MBF handles base data and one MBF handles additional data.

Click to jump to parent topicWorking with Business Functions

Every business function must follow a defined structure and form. Every line of code must conform to the JD Edwards EnterpriseOne business function programming standards. Creating a business function involves these overall tasks:

Business function DLLs are consolidated. Therefore, you need to build each of the custom business functions into a custom DLL that you create. This process ensures that the custom business functions remain separate from JD Edwards EnterpriseOne business functions. The build program reviews the F9860 table to verify that the custom DLL exists.

When you create a custom business function, you need to specify one of the custom DLLs. If you do not, the build process builds the custom business function into the JD Edwards EnterpriseOne CCUSTOM.DLL, where CCUSTOM is the seven-character name of the company, which is the default.

Click to jump to top of pageClick to jump to parent topicPrerequisite

Create a data structure.

Click to jump to top of pageClick to jump to parent topicCreating a Custom DLL

To create a custom DLL:

  1. In OMW, create a new Business Function Library.

  2. In Windows, run BusBuild.exe.

    Typically, this file is located in ..\B9\System\Bin32\.

  3. Rebuild all libraries by selecting Build, Rebuild Libraries in OMW.

    This process takes several minutes.

Click to jump to top of pageClick to jump to parent topicSpecifying a Custom DLL for a Custom Business Function

To specify a custom DLL for a custom business function :

  1. In Business Function Design Aid, enter the custom DLL name in the Parent DLL field.

    Note. You can also change the business function location if necessary.

  2. Run the build for the business function.

Click to jump to parent topicWorking with Business Function Builder

Use JD Edwards EnterpriseOne Business Function Builder to build business function code into a DLL. You can build C business functions, Named Event Rules (NERs), and table event rules. The process that occurs when you run JD Edwards EnterpriseOne Business Function Builder to build business functions includes compiling and linking. Compiling involves creating a business function object. Linking makes the object part of a DLL.

Note. Link All does not compile any business functions; it only links each DLL.

You usually use JD Edwards EnterpriseOne Business Function Builder to build a single business function. Whenever you create source code changes to a business function, you must build the business function to test it.

Build Output displays the results of the build. When the build is finished, the message ***Build Finished*** appears at the bottom of Build Output. The text after this line indicates whether the build was successful. If the build was successful, you can test the business function. Otherwise, you must correct any problems and rerun the build process.

The system creates a work directory when any object is built. This directory is in the destination directory that you specified, such as C:\b7\appl_pgf\work\buildlog.txt. This directory contains error and information logs. The build log contains the same information as the Build Output form in JD Edwards EnterpriseOne Business Function Builder.

Click to jump to top of pageClick to jump to parent topicSetting Build Options

Use options on the Build menu to control how and when the consolidated business function is built. This table describes the available options:

Option

Result

Build

Generates a makefile, compiles the selected business functions, and links the functions into the current consolidated DLL. Rebuilds only those components that are out of date.

Compile

Generates a makefile and compiles the selected business functions. The application does not link the functions into the current consolidated DLL.

ANSI Check

Reviews the selected business function for ANSI compatibility.

Link

Generates a makefile for each consolidated DLL and then builds each consolidated DLL. The application does not compile any of the selected business functions.

Link All

Generates a makefile for each consolidated DLL and then builds each consolidated DLL and links it to all business functions that are called. The application does not compile any of the selected business functions.

Rebuild Libraries

Rebuilds the consolidated DLL and static libraries from the .obj files.

Build All

Links and compiles all objects within each DLL.

Stop Build

Stops the build from finishing. The existing consolidated DLL remains intact.

Suppress Output

Limits the text that appears in Build Output.

Browse Info

Generates browse information when compiling business functions. Clear this option to expedite the build.

Precompiled Header

Creates a precompiled header when compiling a business function. When compiling multiple business functions, the Business Function Builder generally compiles faster if it uses a precompiled header.

Debug Info

Generates debug information when compiling. The Visual C++ can debug any function that was built with debug information. Clear this option to expedite the build.

Full Bind

Resolves all of the external runtime references for each JD Edwards EnterpriseOne consolidated DLL.

Click to jump to top of pageClick to jump to parent topicReading Build Output

Build Output consists of a series of sections that display important information about the status of a build. You can use this information to determine whether the build completed successfully and to troubleshoot problems if errors occurred during the build.

Makefile Section

The makefile section indicates where Business Function Builder generated the makefile for a particular build. JD Edwards EnterpriseOne Business Function Builder generates one makefile for each DLL that it builds. A Generating Makefile statement should always appears for each DLL that you are building. If the makefile statement does not appear, then an error occurred. To resolve the error, you must complete these tasks:

Begin DLL Section

Begin DLL indicates that Business Function Builder is building a particular DLL. For example, assume that the previous section begins with*****CDIST*****. A Begin DLL section appears for each DLL that you are building.

Compile Section

Before it build DLLs, Business Function Builder compiles the business functions in the DLLs first. The system displays a sequential list of each business function that the Business Function Builder attempts to compile. During the compilation process, these events might occur:

Link Section

After Business Function Builder has compiled the business functions for a DLL, it links them. This linking process creates the .lib and .dll files for the DLL. During linking, these events might occur:

Rebase Section

The Rebase Section displays information about rebasing. Rebase fine-tunes the performance of DLLs so that they load faster. Rebase does this by changing the desired load address for the DLL so that the system loader does not have to relocate the image. The system automatically reads the entire DLL and also updates fixes, debug information, checksum information, and time stamp values.

Summary Section

The Summary Section contains the most important information about the build. This section indicates whether the build is successful. The summary section begins with *****Build Finished*****. JD Edwards EnterpriseOne Business Function Builder also displays a summary report for each DLL that you attempted to build. This report includes this information:

Click to jump to top of pageClick to jump to parent topicBuilding All Business Functions

You can use Build All to build all business functions. Build All performs the same operations as global link, and it recompiles all of the objects within each DLL. A system administrator usually runs Build All. Build All processes can take a long time. To run Build All, you must access BusBuild.

To build all business functions:

  1. In Windows, run BusBuild.exe.

    Typically, this file is located in ..\B9\system\Bin32\.

  2. In BusBuild, start the mass build by selecting Build, Build All.

  3. Select one of these options for Build Mode:

  4. Complete the Source Directory field.

    Use this field to specify where the business function source resides. Business function source includes all .c, .h, named event rules, and table event rules. Full packages usually have all business function sources. These are the options for location:

  5. Complete the Foundation Directory field.

    Use this field to specify the foundation to use for this build. The foundation that you select is the foundation on which you expect these business functions to run. These are the options for this field:

  6. Complete the Output Destination Directory field.

    Use this field to specify the location for the output of the build. The build output includes the file types: DLL, .LIB, .OBJ, and LOG. The location options are the same as those for Source Directory. Generally, you should select Package because it is a more stable snapshot of business function source.

  7. Select any of these options:

Select the From RDB option to generate work from any path code. If this option is cleared, the business function builder assumes that the event rules source can be generated from the source directory specification files.

If you are troubleshooting a build initiated by Package Build, then the previous settings should already be set to the correct values. In this case, click Build to rebuild the problem DLLs.

Note. You can also run this build by selecting the Build BSFN option on in a package build.

Click to jump to top of pageClick to jump to parent topicUsing the Utility Programs

The Tools menu contains several utility programs that assist in the build process. This table lists those utilities:

Utility

Purpose

Synchronize JDEBLC

You run the Synchronize JDEBLC program to reorganize JD Edwards EnterpriseOne business functions into new DLL groupings. This program synchronizes DLL field for the local JDEBLC parent specification table with the parent DLL in the F9860 table. Use this program with caution. You typically use this program only if you have manually dragged business function DLLs from a recent package build and you are experiencing failures in the business function load library.

Dumpbin

You run the Dumpbin program to verify whether a particular business function built successfully. This program displays all the business functions that were built into the selected consolidated DLL.

PDB (Program DeBug file) Scan

You receive a CVPACK fatal error when one of the object files that you are trying to link is incorrectly compiled with PDB information. To resolve this problem, you can use the PDB Scan to identify any object fields that were built with PDB information. Recompile any business functions that the PDB Scan reports.

Customize

You use Customize to add programs to the Tools menu. For example, you could add the programming tool and pass that tool a file name as a parameter when it opens.

Safety Check

You use Safety Check to check selected files (.c, .h or both) for:

  • global variables

  • static variables

  • extern declarations

  • non-”threadsafe” ANSI C APIs

Safety Check-Check All

You use Safety Check-Check All to check all files (.c, .h or both) in a directory for the same conditions as for Safety Check.

Resolving Errors with JDEBLC, Dumpbin, and PDB

You use JD Edwards EnterpriseOne  Business Function Builder tools to help you resolve errors. If you notice any unresolved external errors during a business function build, the consolidated DLL still builds, and the software should run normally. However, it cannot execute any unresolved business function.

Use the dumpbin tool to verify that a particular business function is present in a consolidated DLL. If a business function is present, its name appears in the dumpbin output, followed by a nonzero number in parentheses.

Use the PDB scan to resolve the CVPACK fatal error. The CVPACK error occurs when the Business Function Builder attempts to link an object file that was built with PDB (Program DeBug file) information. The PDB scan finds the problem object file. You must then recompile the problem object file on the machine with the JD Edwards EnterpriseOne Business Function Builder.

If a business function is compiled using Visual C++, it will not work properly. You can use PDB scan to identify any business functions that have been built outside of JD Edwards EnterpriseOne Business Function Builder. Use JD Edwards EnterpriseOne Business Function Builder to rebuild these functions so that they work properly.

If one of the DLLs is out of synch, you must rebuild it using the Build option. This generates a makefile and then relinks all the business functions within it.

The Synchronize JDEBLC option from the JD Edwards EnterpriseOne Business Function Builder Tools menu corrects any misplaced or incorrectly-built business functions. This option reviews the server DLLs and determines whether the local workstation specifications match those of the server. If they do not, then JD Edwards EnterpriseOne Business Function Builder will rebuild the business functions in the correct DLL on the server and relink them.

The Build Log contains these sections:

Section

Description

Build Header

This section defines the configuration for a specific build, including the source path, foundation path, and destination path.

Build Messages

This section displays the compile and link activity. During a compile, a line is output for each business function that was compiled Any compile errors are reported as error cxxxx. During the link part, business function builder outputs the text Creating library .... This text might be followed by linker warnings or errors.

Build Summary

The last section of the build summarizes the build for each DLL. This summary is in the form x error(s), x warnings (y). The summary indicates the status of the build. If you have no warnings and no errors, then the build was successful. If the summary reports an error, search the log for the word error to determine the source of the error. Typical build errors are syntax errors and missing files.

Customizing the Tools Menu

This table lists the sections of the Customize menu option:

Menu Option

Usage

Menu Contents

Review all current tools menu customizations.

Menu Text

Enter the text to display in the menu.

Command

Enter the executable to run. You must supply a full path for any program that does not reside in system\bin32 or that is not defined in Initial Directory.

Arguments

Specify any command line arguments to pass to the executable.

Initial Directory

Specify the initial directory that should be used by the executable, if it is not system\bin32.

Include in Build

Select to display output from the program as part of the build process.

Note. This option is only valid and will only appear for Release 8.11 SP1 or later. If you are running an earlier version, this option is not available, and Safety Check does not run during build. You must, instead, run Safety Check manually from the menu.

Hide Window

Select to hide command windows. The functionality remains the same.

This table lists the buttons in the Customize menu option:

Button

Usage

Add

Select to enter new programs to appear in the pull-down menu.

Remove

Select to remove the selected item from the menu.

Move Up

Select to move the selected item up in the menu.

Move Down

Select to move the selected item down in the menu.

Ellipsis

Select to open a file or directory dialog so that you can browse for a file or directory.

Question Mark

Select to display a list of substitutions you can use as part of command line arguments. In our SafetyCheck example, one of the command line arguments is: --F <source_file>. By specifying <source_file>, you are telling SafetyCheck to use as its input file the selected source file. When BusBuild starts the build process, it can determine which file is being built and substitute that name in place of the text <source_file>.

Threadsafe Code

All BSFNs created for JD Edwards EnterpriseOne 8.11 Applications Release and earlier Applications releases are designed to run in a single-threaded environment. BSFNs designed for JD Edwards EnterpriseOne 8.11 SP1 Applications Release and later Applications releases that also run with JD Edwards EnterpriseOne Tools Release 8.96 and later Tools releases are designed to run in a multi-threaded environment. To be considered threadsafe, BSFNs cannot use:

Safety Check is a source code analysis tool that scans C source code and header files for non-threadsafe behaviors. Given a source or header file, Safety Check finds all instances of non-threadsafe code, returning line numbers and code fragments.

Several non-threadsafe APIs have a JD Edwards EnterpriseOne replacement. These replacement APIs have the same parameters as the non-threadsafe C APIs, except where noted. Most non-threadsafe APIs do not have a JD Edwards EnterpriseOne replacement. These APIs and their replacements do not necessarily have the same parameters. Use care when using these APIs.

This table lists the non-threadsafe C APIs for which SafetyCheck searches, the threadsafe standard C replacements, and the threadsafe JD Edwards EnterpriseOne replacements (if applicable):

Non-Threadsafe Standard C API

Threadsafe Standard C API

Threadsafe JD Edwards EnterpriseOne API

acltostr

acltostr_r

None

asctime

asctime_r

jdeJAsctime

crypt

crypt_r

None

ctime

ctime_r

jdeJCtime

drand48

drand48_r

None

ecvt

ecvt_r

None

encrypt

encrypt_r

None

endgrent

endgrent_r

None

endhostent

endhostent_r

None

endnetent

endnetent_r

None

endprotoent

endprotoent_r

None

endpwent

endpwent_r

None

endservent

endservent_r

None

endspwent

endspwent_r

None

endusershell

endusershell_r

None

endutent

endutent_r

None

erand48

erand48_r

None

fcvt

fcvt_r

None

fgetgrent

fgetgrent_r

None

fgetpwent

fgetpwent_r

None

getdate

getdate_r

None

getdiskbyname

getdiskbyname_r

None

getgrent

getgrent_r

None

getgrgid

getgrgid_r

None

getgrnam

getgrnam_r

None

gethostbyaddr

gethostbyaddr_r

jdeGetHostByAddr_r

gethostbyname

gethostbyname_r

jdeGetHostByName_r

gethostent

gethostent_r

None

getlocale

getlocale_r

None

getlogin

getlogin_r

None

getnmtent

getmntent_r

None

getnetbyaddr

getnetbyaddr_r

None

getnetbyname

getnetbyname_r

None

getnetent

getnetent_r

None

getprotobyname

getprotobyname_r

jdeGetProtoByName_r

getprotobynumber

getprotobynumber_r

None

getprotoent

getprotoent_r

None

getpwent

getpwent_r

None

getpwnam

getpwnam_r

None

getpwuid

getpwuid_r

None

getservbyname

getservbyname_r

None

getservbyport

getservbyport_r

None

getservent

getservent_r

None

getspwaid

getspwaid_r

None

getspwnam

getspwnam_r

None

getspwuid

getspwuid_r

None

getusershell

getusershell_r

None

getutent

getutent_r

None

getutid

getutid_r

None

getutline

getutline_r

None

gmtime

gmtime_r

jdeGmtime

inet_ntoa

inet_ntoa_r

jde_inet_ntoa_r

jrand48

jrand48_r

None

l64a

l64a_r

None

lcong48

lcong48_r

None

localtime

localtime_r

jdeLocaltime

Note. The parameters changed on this due to the need to send a location to store the value. The standard C call stores it in a global static variable, which is not threadsafe.

lrand48

lrand48_r

None

ltoa

ltoa_r

None

ltostr

ltostr_r

None

mrand48

mrand48_r

None

nrand48

nrand48_r

None

ptsname

ptsname_r

None

pututline

pututline_r

None

rand

rand_r

jdePPRand

Note. Must be used in conjunction with jdePPSRand to seed the random number generator correctly. Existing calls to srand should be replaced with jdePPSRand.

readdir

readdir_r

None

seed48

seed48_r

None

setgrent

setgrent_r

None

sethostent

sethostent_r

None

setkey

setkey_r

None

setlocale

setlocale_r

jdeSetLocale

setnetent

setnetent_r

None

setprotoent

setprotoent_r

None

setpwent

setpwent_r

None

setservent

setservent_r

None

setspwent

setspwent_r

None

setusershell

setusershell_r

None

setutent

setutent_r

None

srand

srand_r

jdePPSRand

srand48

srand48_r

None

strerror

strerror_r

None

strtoacl

strtoacl_r

None

strtoaclpatt

strtoaclpatt_r

None

strtok

strtok_r

None

ttyname

ttyname_r

None

ultoa

ultoa_r

None

ultostr

ultostr_r

None

utmpname

utmpname_r

None

wcstok

wcstok_r

None

Safety Check Usage

During the course of development, there may be times when a non-threadsafe type of code must be used. You can mark source code with an explanation about why the non-threadsafe code exists. Safety Check will then display this information as part of its run. To mark source code with an exception, include a comment in this format: /*_LRBF <comment text */. The comment must begin with "/*_LRBF." The remainder of the comment can span multiple lines and include any other necessary text. The entire comment will print as part of Safety Check output.

You control Safety Check functionality through several options, at least one of which must be supplied. Multiple options are supported. Quotation marks are required only when the path specified contains spaces. For example, if the single C source file b1234.c is stored in the "c:\source" directory, you could call SafetyCheck in one of two ways: SafetyCheck --F c:\source\b1234.c or SafetyCheck --F "c:\source\b1234.c" However, if the same C source file is stored in the "c:\test files", you must enclose the path/filename in quotations: SafetyCheck --F "c:\test files\b1234.c"

Argument

Usage

--F <C source file>

Use to check a single C source file, for example, --F c:\test\b1234.c

--I <Header file>

Use to check a single header file, for example, --I c:\include\b1234.h

--FD <C source directory>

Use to check all C source files in a given directory, for example, --FD c:\my project\source.

Note. Do not include a trailing slash as part of the directory argument.

--ID <Header file directory>

Use to check all header files in a given directory, for example --ID c:\my project\include

Note. Do not include a trailing slash as part of the directory argument.

--P <Project file>

Use to create a text file that contains a list of files, each of which will be scanned by Safety Check. The project file should contain multiple lines of the form: SOURCE= <fully qualified file name>

Note. Do not use quotation marks in the project file.

For example, a project file that specifies three files to scan could look like this:

SOURCE=c:\my project\source\b1111.c

SOURCE=c:\my project\source\b2222.c

SOURCE=c:\my project\include\main.h

--csv

Use to produce output in a comma-delimited format. The output will contain these elements:

  • File (the fully qualified file name)

  • Line (the line number of the erroneous code)

  • Global (1 if a global was found, 0 if not.)

  • Static (1 if a static was found, 0 if not.)

  • Extern (1 if an external declaration was found, 0 if not.)

  • API (1 if a non-threadsafe API was found, 0 if not.)

  • BraceMismatch (1 if scanning could not complete due to a brace mismatch)

  • Exception (1 if an exception comment was found, 0 if not.)

  • CouldNotOpen (1 if the file could not be opened, 0 if it could.)

  • NotCSource (1 if the file name did not end in either ".c" or ".h")

  • C++Comment (1 if a C++ style comment was found)

  • CapInclude (1 if a capital letter was used in a #include)

  • LastChar (1 if the last character was not a new line character)

  • CommentInComment (1 if a comment was found inside a comment)

--X

Select to print a warning message when a file to check is specified that does not end in "c" or "h". By default, these warning messages are hidden.

Safety Check Output

A “clean” Safety Check run will produce output of this format:

---------------- SafetyCheck Started ---------------

Scanning d:\safetychecktestrun\source\b03b0011.c...

---------------------- Done ----------------------

1 Files Processed 0 Errors 0 Warnings

“Files processed” indicates how many files were scanned. “Errors" reports the number of file-based errors encountered. “Warnings” reports the number of problems found while scanning the specified files.

A “dirty” Safety Check run will produce output of this format:

---------------- SafetyCheck Started ---------------

Scanning d:\safetychecktestrun\source\b03b0011.c...

d:\safetychecktestrun\source\b03b0011.c(186): Global variable found

int iGlobal = 0;

---------------------- Done ----------------------

1 Files Processed 0 Errors 1 Warnings

In this case, the output indicates:

Note that the global variable was specified as a "Warning" and not an "Error".

Safety Check Limitations

Following are limitations for safety check:

  1. Safety Check is a static code analysis tool that does not perform preprocessing of source code. Therefore, macro substitutions may introduce non-threadsafe behaviors that cannot be detected by Safety Check.

  2. Safety Check does not know which compile-time flags may be set. Problems will occur in code that looks like this because the number of open braces does not match the number of close braces:

    int FunctionOne(int i) { if (i == 0) #ifdef FLAG1 { ++i; #else { --i; #endif } }

  3. Non-threadsafe code may still exist even though Safety Check reports no warnings. Safety Check is looking for the presence of only four specific code elements (globals, variables, externs and non-threadsafe ANSI C APIs). Do not rely solely on a “clean” run of Safety Check as the only test of whether the code is threadsafe.

Click to jump to top of pageClick to jump to parent topicUnderstanding Business Function Processing Failovers

In some instances in which a business function fails to process correctly, the software can attempt to recover and reprocess the transaction. The system recognizes two principle failure states: process failure and system failure.

A process failure occurs when a jdenet_k process aborts abnormally. For a process failure, the software server processing launches a new jdenet_k process and continues processing.

A system failure occurs when all the server processing fails, the machine itself is down, or the client cannot reach the server because of network problems. For a system failure, business function processing must be rerouted either to a secondary server or to the local client. The system uses this process to attempt to recover from this state:

After one module switches, all subsequent modules switch to the new location.

Click to jump to parent topicWorking with Business Function Documentation

This section provides an overview of business function documentation, and discusses how to:

Click to jump to top of pageClick to jump to parent topicUnderstanding Business Function Documentation

Business function documentation explains what individual business functions do and how they should be used. The documentation for a business function should include this type of information:

You use Business Function Design and Data Structure Design to document the business functions.

Click to jump to top of pageClick to jump to parent topicCreating Business Function Documentation

You can create business function documentation for several levels, including these:

Generating business function documentation provides you with an online list of information about business functions that you can view through the Business Function Documentation Viewer (P98ABSFN). Typically, the system administrator performs this task because generating the business function documentation for all business functions takes considerable time. If you create new business function documentation, you need to regenerate the business function documentation for that business function only.

Run UBE R98ABSFN, batch version XJDE0001 to generate all business function documentation. The system creates a hypertext markup language (HTML) link for each business function for which you generated documentation. It also creates an Index HTML file. These HTML files appear in the output queue directory.

Click to jump to top of pageClick to jump to parent topicViewing Documentation from Business Function Documentation Viewer

You can use Business Function Documentation Viewer to view documentation for all business functions or selected business functions. After you generate the report, use the Business Function Documentation Viewer (P98ABSFN) to display the information. It is suggested that you use this method to view business function documentation.

The Business Function Documentation form contains the HTML index that you generated. To view the entire index or select specific functions, click the appropriate letter in the index. Double-click a business function to view documentation that is specific to that function.

The media object loads the HTML index of the business functions based on a media object queue. In the media object queue table, a queue named Business Function Doc is defined.

This queue must point to the directory in which the business function HTML files are located. The system administrator usually generates the documentation for all business functions. Because the generation process places the documentation files in the local directory, the administrator must then copy the files to a central directory on the deployment server. The files must be copied to the media object queue for media object business function notes. If you are using the standalone version of the software, this path is usually the output directory from the Network Queue Settings section of the jde.ini file. If this entry is not in the jde.ini file, it is in the print queue directory in the JD Edwards EnterpriseOne software directory.