CreateWOHeader

Create WO Header

Minor Business Rule

Object Name: B3400530

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This function is to be replaced with a Master Business Function based on the AS/400 X4201WO program.  

Temporarily, this function will perform an update of the F4801 record by either Requested Date or 

Required Quantity fields or it will create a new Work Order Header record in F4801.  


This function is divided into two segments.  Based on whether the program has been passed in an Order 

Number will determine which section will be called.  

If an Order Number is passed in, the first segment will update either the WAUORG (Required 

Quantity) field or the WADRQJ (Requested Date) field in the F4801 using the WADOCO (Order Number), 

WAMCU (Branch), WADCTO (Order Type) fields as keys.  Note: If Requested Date is the desired update, 

be sure to set Required Quantity to blank.


If no Order Number exists, the second segment will be called.  This part creates a WO header 
record in the F4801.  A new Document is retrieved using the system call X0010GetNextNumber.  Start Date 

is calculated by calling B3100290 Calculate Order Lead Time and using the lead time as input to call 

B3100300 ForwardSchedule Dates.  The function then returns Order Number and Start Date to the calling 

function.  


1.1Purpose

The purpose of this business function is to enable answering an order message from P3411 MPS/MRP 

Detail Message Revisions for a manufacturing (Work) order. This function will  create a Work Order header, 

passing the necessary fields.  The created Work Order document number and the Start Date will be 

returned to F3411.

Or this function will update the Requested Date or Required Quantity Fields.



1.2Setup Notes and Prerequisites

None



1.3Special Logic

This function will only populate the Work Order header with the required information for entry plus a 

status code.  It will NOT include passing any other parameters from Processing Options for either a 

version of P48013 or P3411.


2.Technical Specifications

 

1. If Order Number exists:

A. Open Table F4801 using Update Structure

1. If successful, set up Select structure using Branch and  Order Type Fields

a. Fetch record from select structure using Order Number as key 

field.

b. If fetch successful (Order Number exists in F4801): 

1. Copy input from Data Structure (lpDS) to F4801 data 

structure

szProgramID-WAPID

mnOrderNumber -WADOCO

jdStartDate-WASTRT

2. Call GetAuditInfo

a. Copy output from dsB9800100 to F4801 Input Data 

Structure

szUserName-WAUSER

szWorkstation_UserId-WAJOBN

jdDate-WAUPMJ

mnTime-WATDAY

3. If mnRequiredQuantity is not equal to zero

Copy  Required Quantity to F4801 Input Data Structure

mnRequiredQuantity -WAUORG

4. Else, copy Requested Date to F4801 Input Data Structure

jdRequestedDate -WADRQJ

5. Update Table F4801 using Input Data Structure

c. else fetch not successful

set return code error

2. Else Open Table not successful

set return code error

2. else Order Number does not exist - create new record

A. Open Table F4801 using Update Structure

1. If successful, 

a.copy input from Data Structure (lpDS) to F4801 data structure

mnShortItemNumber -WAITM

szSupplyBranch WAMMCU

mnRequiredQuantity-WATRQT

jdRequestedDate-WARRQJ

szOrderType-WADCTO

szWOStatusCode-WASRST

szProgramID-WAPID

b. Call GetAuditInfo: Copy output from dsB9800100 to F4801 

DataStructure

szUserName-WAUSER

szWorkstation_UserId-WAJOBN

jdDate-WAUPMJ

mnTime-WATDAY

c. Set workfield docoexists to 1 (# exists)

    While docoexists == 1

Call System Function X0010GetNextNumber: 

1. if successful, 

copy mnNextNumber001 to F4801 Fetch data structure

fetch on ordernumber

if fetch not successful 

set docoexists == 0 to exit loop

copy output dsX0010 to F4801 data structure

mnNextNumber001 - WADOCO

2. else system function X0010 failed

set return code error

set docoexists == 0 to exit loop

d. Calculate Start Date

     Input data from lpDS to B3100290 data structure

szUOMProduction-szUnitOfMeasure

szSupplyBranch-szBranch

mnRequiredQuantity-mnOrderQuantity

mnShortItemNumber-mnShortItem

     Call B3100290 Calculate Order Lead Time 

     If successful

Copy output to B3100300 Data Structure

mnLeadTimeDays-mnNumberOfDays

Input data from lpDS to B3100300 Data Structure

jdRequestedDate-jdInputDate

szSupplyBranch-szBranchPlant

set cScheduleType = 'B'/* back scheduling */

Call B3100300 Forward/BackwardScheduleDates

copy output to F4801 Data Structure

jdOutputDate-WASTRT

Write record to F4801. (WAITM, WAMMCU, WAUORG, 

WADRQJ,WADCTO, WAUOM,  WASRST, WADOCO,WASTRT, WAUSER, WAJOBN, WAUPMJ, WATDAY, 

WAPID )

Load Document # and Start Date into Program data 

structure

WASTRT-jdStartDate

WADOCO-mnOrderNumber

3. if return code  == ER_ERROR or API return value == JDEDB_FAILED

a. set error message to 3143

b. if cSuppressMessage does not = '1'

Set GBR Error

set return code = ER_ERROR

4. Program cleanup

5. Return 

Data Structure

D3400530 - Create WO Header

Parameter NameData ItemData TypeReq/OptI/O/Both
mnShortItemNumberITMMATH_NUMERICNONENONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

szBranchMMCUcharNONENONE

A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which 
represent lower-level business units, subordinate to it. For example:     o Branch/Plant (MMCU)     o Dept A (MCU)     o Dept B (MCU)     o Job 123 
(MCU) Business unit security is based on the higher-level business unit.

mnRequiredQuantityTRQTMATH_NUMERICNONENONE

A value that represents the available quantity, which might consist of the on-hand balance minus commitments, reservations, and 
backorders. You enter this value in the Branch/Plant Constants program (P41001).

jdRequestedDateRRQJJDEDATENONENONE

The completion date planned for this order.

szOrderTypeDCTOcharNONENONE

A user defined code (00/DT) that identifies the type of document. This code also indicates the origin of the transaction. J.D. Edwards has 
reserved document type codes for vouchers, invoices, receipts, and time sheets, which create automatic offset entries during the post 
program. (These entries are not self-balancing when you originally enter them.) The following document types are defined by J.D. Edwards and 
should not be changed: P Accounts Payable documents   R Accounts Receivable documents   T Payroll documents   I Inventory documents  
O Purchase Order Processing documents   J General Accounting/Joint Interest Billing documents   S Sales Order Processing documents

szUOMProductionUOM8charNONENONE

A user defined code (00/UM) that indicates the unit of measure in which you produce the item.

szWOStatusCodeSRSTcharNONENONE

A user defined code (00/SS) that describes the status of a work order, rate schedule, or engineering change order. Any status change from 
90 through 99  triggers the system to automatically update the completion date.

mnOrderNumberDOCOMATH_NUMERICNONENONE

A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry, 
and so on.

jdStartDateSTRTJDEDATENONENONE

The start date for the order. You can enter this date manually, or have the system calculate it using a backscheduling routine. The routine 
starts with the required date and offsets the total leadtime to calculate the appropriate start date.

szErrorMessageIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

cSuppressErrorMessageEV01charNONENONE

An option that specifies the type of processing for an event.

szProgramIDPIDcharNONENONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

szDescriptionDL01charNONENONE

A user defined name or remark.

szBusinessUnitMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

sz3rdItemNumberAITMcharNONENONE

The system provides three separate item numbers plus an extensive cross-reference capability to alternate item numbers. These item 
numbers are as follows: 1.  Item Number (short) - An 8-digit, computer-assigned item number. 2.  2nd Item Number - The 25-digit, free-form, user 
defined alphanumeric item number. 3.  3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item number.  In addition to 
these three basic item numbers, an extensive cross-reference search capability has been provided (see XRT). Numerous cross references to 
alternate part numbers can be user defined, such as substitute item numbers, replacements, bar codes, customer numbers, or supplier 
numbers.

sz2ndItemNumberLITMcharNONENONE

A number that identifies the item. The system provides three separate item numbers plus an extensive cross-reference capability to 
alternative item numbers. The three types of item numbers are: Item Number (short) An 8-digit, computer-assigned item number. 2nd Item Number A 
25-digit, user defined, alphanumeric item number. 3rd Item Number  Another 25-digit, user defined, alphanumeric item number. In addition to 
these three basic item numbers, the system provides an extensive cross-reference search capability. You can define numerous 
cross-references to alternative part numbers. For example, you can define substitute item numbers, replacements, bar codes, customer numbers, or 
supplier numbers.

mnManagerANSAMATH_NUMERICNONENONE

The address book number of a manager or planner.   Note:  A processing option for some forms allows you to enter a default value for this 
field based on values for category codes 1 (Phase), 2, and 3.  You set up the default values on the Default Managers and Supervisors form.  
After you set up the default values and the processing option, the default information displays automatically on any work orders that you 
create if the category code criterion is met.  You can either accept or override the default value. 

szTypeBillTBMcharNONENONE

A user defined code (40/TB) that designates the type of bill of material. You can define different types of bills of material for different uses. 
For example:    M     Standard manufacturing bill    RWK   Rework bill    SPR   Spare parts bill  The system enters bill type M in the work order 
header when you create a work order, unless you specify another bill type. The system reads the bill type code on the work order header to 
know which bill of material to use to create the work order parts list. MRP uses the bill type code to identify the bill of material to use when it 
attaches MRP messages. Batch bills of material must be type M for shop floor management, product costing, and MRP processing.

szTypeRoutingTRTcharNONENONE

A user defined code (40/TR) that indicates the type of routing. You can define different types of routing instructions for different uses. For 
example:    M    Standard Manufacturing Routing    RWK  Rework Routing    RSH  Rush Routing You define the routing type on the work order 
header. The system then uses the specific type of routing that you define in the work order routing. Product Costing and Capacity Planning systems 
use only M type routings.

cTypeTYPScharNONENONE

A user defined code (00/TY) that indicates the classification of a work order or engineering change order. You can use work order type as a 
selection criterion for work order approvals.

Related Functions

None

Related Tables

None