1.Functional Description
This business function reads the MRP Item Quantity Cache and calculates the Adjusted Forecast and
Sales Order Quantities based on the Time Fence Rule and Time Fence Days. It then updates the cache with
the calculated quantities. The time fence rules handled are 'G', 'C', 'F' ,'S', '1', '3' and 'H' with
forecast consumption logic turned on.. These are described in the UDC tables and are hard coded.
1.1Purpose
This function is used to net the requirements of an Item based on how the sales and forecasts are
handled based on the Time fence rules for the MRP Planning Program. Forecast Consumption logic using
Shipped quantities is also taken into account before adjusting the sales orders with the forecast
quantities.
1.2Setup Notes and Prerequisites
The following must be done prior to calling the function:
The application must call business function B3401270 to create the planning caches.
The User Index F34UI001 must be Loaded with the Planning Dates using Business Function B3400360.
Item Balance Data - Time Fence Rule and the Planning Date must be precalculated and obtained.
This business function will be exclusively used by the planning programs and hence caution must be
used while modifying or maintaining it.
1.3Special Logic
None
2.Technical Specifications
The following actions have to be performed by the Business Function.
1. Get Cache Handles and Initialize Arrays to Zero
Create the following Arrays an Initialize them
@FQU[$PND] - Forecast Quantity Unadjusted
@FQ[$PND] - Forecast Quantity Adjusted
@SOU[$PND] - Sales Order Quantity Unadjusted
@SO[$PND] - Sales Order Quantity Adjusted
@BD[$PND] - Bucket Flag Array
@HQ[$PND] - Shipped Quantities Array
Wk Exit flag = ' '
Wk Index $X = 0
Wk First Call = '1'
// Load @DT, @BD, @FC arrays from the bucketless date cache.
While Cache Error Code = '0'
@BD[$X] = Bucket Flag (EV01) from Cache.
@FC[$X] = Forecast Consumption Bucket Flag (EV03) from Cache.
$X++
Call B3401270 in mode '6' to get next date record from cache using Input Date
Branch.
End While
// Load @SOU, @FQU(Unadjusted Sales Orders and Unadjusted Forecast Quantities) from cache.
Wk Cache Branch = Input Branch
If Input Consolidation Method = '2'
Wk SalesOrderType = 'SOT'
Else
If Input Consolidation Method = '1'
Wk Cache Branch = Input Date Branch
End If
Call B3401290 in mode '1' to get first quantity record from cache using Wk Cache Branch.
If Quantity Type from Cache = 'FQU'
@FQU[$X] = @FQU[$X] + Quantity from Cache.
Else
If Quantity Type from Cache = SalesOrderType
End If
If Cache Cursor Ptr <> 0 then
Call B3401290 in mode '9' to close out the cursor and free data ptr.
End If
Wk End Date = @DT[$PND]
If Input $$SFOG = 'H' And $$FCP = '1' And Input $52 = '1' then
Execute internal function Adjust Forecast Quantities using Shipped Quantities.
Close all Tables and Deallocate memory for Arrays
Exit the function with Error Code = 0
2. Internal Function Calculate the Adjusted Quantities
** Note that @SQ is actually @SO
If Input $$SFOG = Blanks, $$SFOG = 'G' and Input $$PLDT = Wk End Date + 1
Wk Quantity = 0
Wk Index ($G) = 1.
For $X = 1 to $PND, Do
If Input $$FCP = '1' And $$SFOG = 'H' then Break
If @FQU[$X] > 0 or @SQU[$X] > 0
Begin Case
Case $$SFOG = 'C'
If @DT[$X] > $$PLDT
@SQ[$X] = @SQU[$X]
@FQ[$X] = @FQU[$X]
Wk Quantity = Wk Quantity + @SQ[$X]
Else
@SQ[$X]= @SQU[$X]
Endif
Break
Case $$SFOG = 'F'
If @DT[$X] > $$PLDT
@SQ[$X]= @SQU[$X]
@FQ[$X] = @FQU[$X]
Else
@FQ[$X]= @FQU[$X]
Endif
Break
Case $$SFOG = 'G'
If @DT[$X] > $$PLDT
@FQ[$X]= @FQU[$X]
Else
@SQ[$X]= @SQU[$X]
@FQ[$X] = @FQU[$X]
Wk Quantity = Wk Quantity + @SQ[$X]
Endif
Break
Case $$SFOG = 'S'
If @DT[$X] > $$PLDT
@FQ[$X]= @FQU[$X]
Else
@SQ[$X]= @SQU[$X]
Endif
Break
Case $$SFOG = '1'
If @DT[$X] > $$PLDT
@FQ[$X]= @FQU[$X]
Endif
Break
Case $$SFOG = '3'
If @DT[$X] > $$PLDT
@FQ[$X]= @FQU[$X]
@SQ[$X] = @SQU[$X]
Endif
Break
Endcase
Endif
If @BD[$X] = 'B'
$G = $X.
If ($$SFOG = 'G' and @DT[$G] <= $$PLDT) or ($$SFOG = 'C' and
@DT[$G] > $$PLDT)
Do the following
If @FQ[$G] > 0
If Wk Quantity >= @FQ[$G]
Wk Quantity = Wk Quantity - @FQ[$G]
@FQ[$G] = 0
Else
@FQ[$G] = @FQ[$G] - Wk Quantity
Wk Quantity = 0
Endif
Endif
$G = $G -1
End While @BD[$G] <> 'B' and $G > 0
Wk Quantity = 0
Endif
Endif
Enddo
If Input $$FCP = '1' And $$SFOG = 'H' then
Copy All @FQU values to @FQ
Copy All @SQU value to @SQ
Call Adjust Sales and Forecast Qtys using Forecast Consumption.
End If
// Output Array Quantities into Cache as Adjusted Sales Order and Forecast Quantities.
If @SQ[$X] > 0
If @HQ[$R] > 0
Call B3401290 in mode '1' using Wk Cache Branch, @DT[$R], and 'SHP' and @HQ[$X]
End If
3.Internal Function Adjust Forecast Quantities using Shipped Quantities
//Load Sales Order Shipped Quantities - S005S
If Input Consolidation Method = '1' then
// Select Shipped Qtys by a group of branches.
Wk Number of Plants = Input Number of Branches.
$X = 0
Select All Records from F35UI001
While Exit <>'1'
Read F35UI001
If Failed then Exit Loop.
Copy Branch to @Branch[$X * sizeof(MCU)]
$X++
End While
Select F3462 Records using MBITM=Input Item, MBMCU=@Branch and Input $$FBDT <= MBPDDJ <=
Wk End Date.
<= Wk End Date
Wk Exit Flag = '0'
While Wk Exit Flag <> '1'
Fetch F3462 Record.
If Fetch Failed then Break out of While Loop
If MBPDDJ = 0 then Continue
Scan @DT for first @DT[$X] >= MBPDDJ
If Scan Succeeded then
@HQ[$X] = @HQ[$X] + MBUORG
End If
End While
// Adjust Shipped Quantities with Unadjusted Forecast Quantities.
Wk $$BALQ = 0
Scan @DT for @DT[$R] > $$Input $$FBDT
Wk Index $$BG=$R
For $R = $$BG to $$PND
$$BALQ = $$BALQ + @HQ[$R]
@HQ[$R] = 0
If @FC[$R] = '1'
For $X = $$BG to $R
If @FQU[$X] < 0 And $X <> $R then Continue.
If $X <> $R
If $$BALQ >= @FQU[$X]
$$BALQ = $$BALQ - @FQU[$X]
@HQ[$X] = @HQ[$X] + @FQU[$X]
@FQU[$X] = 0
Else
@FQU[$X] = @FQU[$X] - $$BALQ
@HQ[$X] = @HQ[$X] + $$BALQ
$$BALQ = 0
End If
Else
@FQU[$X] = @FQU[$X] - $$BALQ
@HQ[$X] = @HQ[$X] + $$BALQ
$$BALQ = 0
$$BG = $X + 1
If $$BG > $$PND then
$$BG = $$PND
End If
If @FQU [$X] < 0 then
@FQU[$X] = 0
End If
End If
End For
End If
End For
If @Branch was allocated then Free the memory used for this array.
4. Adjust Sales Order and Forecast Quantities Using Forecast Consumption
For $X = 1 to $$PND
If @DT[$X] <= Plan Date $$PLDT
Copy @SQU[$X] to @SQ[$X]
End If
Copy @FQU [$X] to @FQ[$X]
End For
Wk $$BALQ = 0
For $X = 1 to $$PND And @DT[$X] <= $$PLDT
If @SQ[$X] <> 0 Or @FQ[$X] <> 0 then
FQ[$X] = 0
Else
FQ[$Y] = FQ[$Y] - Balance
Balance = 0
D3400400 - MRP, Update Adjusted Sales and Forecast Qty
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
cTimeFenceRule | MPSP | char | NONE | NONE |
A code (system 34, table TF) that the system uses in conjunction with the Planning Time Fence Days field to determine how forecast
| ||||
jdPlanDate | DATE01 | JDEDATE | NONE | NONE |
Event point for JDE Date. | ||||
cSuppressErrorMessage | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
cErrorCode | ERRC | char | NONE | NONE |
This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document
| ||||
szErrorMessageID | DTAI | char | NONE | NONE |
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
| ||||
szBranch | MCU | char | NONE | NONE |
An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit
| ||||
szJobNumber | JOB | char | NONE | NONE |
Job Number | ||||
jdFirstDate | DATE01 | JDEDATE | NONE | NONE |
Event point for JDE Date. | ||||
cForecastConsumptionFlag | EV03 | char | NONE | NONE |
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,
| ||||
jdForecastBeginningDate | DATE04 | JDEDATE | NONE | NONE |
Event point for JDE Date. | ||||
nNumberBucketlessDates | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
mnShortItemNumber | ITM | MATH_NUMERIC | NONE | NONE |
An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item
| ||||
nNumberPastDueDates | INT02 | integer | NONE | NONE |
Number of Days in the Past to Query for Quote Requests Received. | ||||
cIncludeShippedQuantities | EV04 | char | NONE | NONE |
PeopleSoft event point processing flag 04. | ||||
szDateBranch | MCU | char | NONE | NONE |
An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit
| ||||
cConsolidationMethod | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
nNumberOfBranches | INT01 | integer | NONE | NONE |
Number of Days in Future to Query for Responses Due. | ||||
szComputerID | CTID | char | NONE | NONE |
cForecastIncluded | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cSalesOrderIncluded | EV02 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cSupplyDemandExists | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
cInterplantConsumesForecast | EV01 | char | OPT | NONE |
An option that specifies the type of processing for an event. | ||||
szProgramId | PID | char | OPT | NONE |
The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry
| ||||
szNewForecastType | TYPF | char | OPT | NONE |
A user defined code (34/DF) that indicates one of the following:
o The forecasting method used to calculate the numbers displayed about
| ||||
szUserId | USER | char | OPT | NONE |
The code that identifies a user profile. | ||||
mnCustomerNumber | AN8 | MATH_NUMERIC | OPT | NONE |
A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or
|
B3401270 Cache, Process MRP Bucketless Dates | ||||
B3401290 Cache, Process MRP Item Quantities |
F3462 Forecast Shipment Summary | ||||
F35UI001 MPS/MRP Planning - Multiple Plant User Index |