CalculateAndWriteATPRecords

Calculate And Write ATP Records

Minor Business Rule

Object Name: B3400320

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This business function will read the Supply and Demand Work table (F4021W) and calculate available to 
promise (ATP) values based on the supply and demand records it contains.  New records will be written 

to the table with calculated ATP values as required.


1.1Purpose
This function is used to calculate and write ATP records to the F4021W table for Supply and Demand 
Report.  This function will return error codes as necessary.


1.2Setup Notes and Prerequisites

• None

1.3Special Logic

None.


2.Technical Specifications

Wk Last Seq No = 0
Wk ATP Date = 0

Wk ATP Qty = 0

Wk ATP Seq No = 0

Wk Supply Qty = 0

Wk Demand Qty = 0

Wk Lot Demand Qty = 0

Skip Flag = ' '

Exit Flag = ' '


Open the F4021W table

If the table open failed

Set Error Code to '1'

Set Error Message ID to '3143'

Exit the function

Endif


While Exit Flag <> '1'

Read F4021W table sequentially using Item and Branch as partial keys

If not found

Exit Flag = '1'

Write ATP record with ITM, MCU, MMCU, Wk ATP Date, Wk ATP Seq No + 5, M5NUMR, and

Wk ATP Qty

Else

Skip Flag = ' '

If M5BSEQ = 0 and Input Summary Flag = '1'

Skip Flag = '1'

Endif


Wk Supply Qty= M5TRQT

Wk Demand Qty= M5SOQS

If M5BSEQ < 70

If Wk Last Seq < 70 and Wk ATP Date = M5DRQJ

Wk ATP Qty = Wk ATP Qty + Wk Supply Qty

Wk ATP Seq No = M5BSEQ

Else

Write ATP record with ITM, MCU, Wk ATP Date, Wk ATP Seq No + 5, M5NUMR, and

Wk ATP Qty

Wk ATP Date = M5DRQJ

Wk ATP Seq No = M5BSEQ

If ATP Flag = '2'

If M5BSEQ = 10

Wk ATP Qty = Wk ATP Qty - Wk Demand Qty

Else

Wk ATP Qty = Wk ATP Qty + Wk Supply Qty

Endif

Else

Wk ATP Qty = Wk Supply Qty

Endif

Endif

Else

If M5BSEQ <> 80/* changed 04/30/96, Forecast Typ = 80 not 70 */

Wk ATP Qty = Wk ATP Qty - Wk Demand Qty

Endif

Endif


If  M5BSEQ = 10

If Wk Lot Demand Qty < M5SOQS

M5SOQS = M5SOQS - Wk Lot Demand Qty

Wk Lot Demand Qty = 0

Else

Skip Flag = '1'

Endif

Endif


If M5BSEQ  >= 70

Wk Lot Demand Qty = Wk Lot Demand Qty + M5SOQS

Endif


If Skip Flag <> '1'

Wk  Last Seq = M5BSEQ

Endif

Endif

EndWhile


Close the F4021W table and exit the function




Data Structure

D3400320 - Calculate And Write ATP Records

Data Item Data Structure DescriptionI/ORequiredNotes

ITM            Short Item Number                  IY

MCU            Branch                        IY

EV01            ATP Flag                        IY      '1' - Calculate and write ATP 

records                                                                         '2' - Calculate and 

write cumulative                                                                                        

                                                         ATP records

EV02            Item Location Summary Flag      IY      ' ' - Do not summarise item 

location                                                                         records '1' - 

Summarize item location                                                                         records

EV03            Suppress Error Message            I      ' ' - Display Errors '1' - 

Suppress                                                                                                 

                                                Error Message

ERRC            Error Code                        O      '0' - Success (Default) '1' - 

Errors                                                                         in processing table

DTAI            Error Message ID                  O      ' ' - Success '3143' - Errors


^

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

szBranchMCUcharNONENONE

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.

cATPFlagEV01charNONENONE

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

cItemLocationSummaryFlagEV02charNONENONE

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

cSuppressErrorMessagesEV03charNONENONE

A radio button that specifies the level at which trace/track result is to be displayed.  Select the Detail to display all transactions except IB, IX, 
and IZ types.  Or, select Derivative Lots Only to display only those transactions that may have created new derivative lot. 

cErrorCodeERRCcharNONENONE

This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document 
Set Server program (XT4914).

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.

szUserIdUSERcharOPTNONE

The code that identifies a user profile.

szComputerIDCTIDcharOPTNONE

szJobNumberJOBcharOPTNONE

Job Number

Related Functions

None

Related Tables

None