Professional Documents
Culture Documents
Document 135331.1
Document 135331.1
Document 135331.1
The Open Forecast Entries Application Program Interface(API) allows you to create, replace, or delete forecast entries for
existing forecasts and forecast sets in Oracle Master Scheduling/MRP Note that you cannot update, only replace, so if
reloading a forecast with updates - such as adding more entries for the future - then all previous rows for that same
forecast name must also be uploaded again.
The purpose of this essay is to explain how to use the Open Forecast Entries API so that you can integrate other
applications with Oracle Master Scheduling/MRP. TheOpen Forecast Entries API differs from the Open Forecast Interface in
two ways:
There is tighter coupling between the calling interface and the MRP system.
It is used for synchronous actions on the forecasting data, and you can manipulate data within a commit cycle
controlled by the calling module.
Functional Overview
You can process MRP Forecast Entries directly from within your calling module without running a concurrent process, it is
PL/SQL based. This program allows you to create new forecasts, replace existing forecasts, and delete forecast entries
within a defined forecast name or designator. The forecast data that needs to be imported is loaded from a table and
inserted into the MRP_FORECAST_DATES parameter.
The Open Forecast Entries Application Program Interface PL/SQL table is described in the following table:
FORECAST_DESIGNATOR Varchar2(10) X
ORGANIZATION_ID Number X
FORECAST_DATE Date X
LAST_UPDATE_DATE Number x
CREATION_DATE Date x
CREATED_BY Number x
LAST_UPDATE_LOGIN Number x x
QUANTITY Number x
PROCESS_STATUS Number x
CONFIDENCE_PRECENTAGE Number x
COMMENTS Varchar2(240) x
ERROR_MESSAGE Varchar2(240) X
REQUEST_ID Number X
PROGRAM_APPLICATION_ID Number X
PROGRAM_ID Number X
PROGRAM_UPDATE_DATE Date X
WORKDAY_CONTROL Number x
BUCKET_TYPE Number x
FORECAST_END_DATE Date x
TRANSACTION_ID Number x
SOURCE_CODE Varchar2(10) x
SOURCE_LINE_ID Number x
PROJECT ID Number(15) x
TASK ID Number(15) x
LINE_ID Number(15) x
ORGANIZATION_ID Number x
FORECAST_DESIGNATOR Varchar2(10) x
Legend
Returns
True if successful.
False if failure.
Parameters
Required Data
PROCESS_STATUS indicates the current state of processing of each new forecast entry. Valid values include:
1 - Do not process
2 - Waiting to be processed
When you first load a new forecast entry into the Open Forecast Entries Interface, set PROCESS_STATUS to 2 (Waiting to
be processed). The values 3 (Being processed), 4 (Error), and 5 (Processed) are used to report back to the calling
program.
Derived Data
The concurrent program and WHO columns, along with the error message column, are derived and set by the API
accordingly.
Optional Data
Use WORKDAY_CONTROL to indicate the action that the Forecast Interface Entry should take if it finds a forecast date or
forecast end date that is not a valid workday. Enter one of the following:
1 - Reject
2 - Shift forward
3 - Shift backward
If WORKDAY_CONTROL is set to Null, the Forecast Interface Entry program assumes a value of 1 (Reject).
Use BUCKET_TYPE to indicate the bucket type of each new forecast entry. Enter one of the following:
1 - Days
2 - Weeks
3 - Periods
If BUCKET_TYPE is null, the Forecast Interface Load program assumes a value of 1 (Days).
Use TRANSACTION_ID if you wish to replace an existing entry in MRP_ FORECAST_DATES with a new forecast entry that
you have loaded into the Open Forecast Interface. The Forecast Interface Load deletes any existing entries in
MRP_FORECAST_DATES with the same TRANSACTION_ID before importing the newforecast entry.
Use SOURCE_CODE and SOURCE_LINE_ID to identify the source of new forecast entries.
See Also
Validation
Standard Validation
Oracle Master Scheduling/MRP validates all required columns in the interface table. For specific information on the data
implied by these columns, see your Oracle Master Scheduling/MRP Reference Manual for details.
Other Validation
Oracle Open Forecast Entries Interface also performs the following validation:
1 - Do not process
2 - Waiting to be processed
FORECAST_END_DATE Must be greater than or equal to FORECAST_DATE. Must be greater than 0 and less than or
equal to 99999999.9.
1 - Reject
2 - Shift forward
3 - Shift backward
1 - Days
2 - Weeks
3 - Periods
Populate table T_FORECAST_INTERFACE with all the forecast data that needs to be imported. Set
PROCESS_STATUS to a value of 2 for all rows.
The Forecast Interface Entry program creates a new row in MRP_FORECAST_ITEMS for each new forecast entry
that refers to an item that has not beenassigned to the forecast referenced in the Open Forecast Interface.
The application program interface will process the rows and set the column PROCESS_STATUS to a value of either 4
or 5:
Populate table T_FORECAST_INTERFACE with all the forecast data that needs to be imported. Set
PROCESS_STATUS to a value of 2 for all rows.
Populate table T_FORECAST_DESIGNATOR with all the forecast desIgnators for which entries need to be deleted.
FORECAST_INTERFACE, RECAST_DESIGNATOR.
The application program interface will delete the existing entries for each forecast designator in
T_FORECAST_DESIGNATOR. It will process the rows in T_FORECAST_INTERFACE and set the column
PROCESS_STATUS to a value of either 4 or 5:
Populate table T_FORECAST_DESIGNATOR with all the forecast desIgnators for which entries need to be deleted.
The application program interface will delete the existing entries for each forecast desIgnator in
T_FORECAST_DESIGNATOR.
Error Handling
The Open Forecast Entries Interface program will process the rows and report the following values for every record in the
FORECAST__INTERFACE entry table.
Success 5 Null
Example
Cut between the two /*=========*/ line and save this script in fcstapi.sql. Then launch the api with the corresponding
inventory_item_id, forecast_designator, quantities, and, forecast_dates.
/*=======================================================================*/
set serveroutput on
/**************************************************************************************************
**************************************************************************************************/
Declare
t_forecast_interface_tab MRP_FORECAST_INTERFACE_PK.t_forecast_interface;
t_forecast_designator_tab MRP_FORECAST_INTERFACE_PK.t_forecast_designator;
var_bool BOOLEAN;
begin
t_forecast_interface_tab(1).inventory_item_id := 3921;
t_forecast_interface_tab(1).forecast_designator := 'SK-FORECST';
t_forecast_interface_tab(1).organization_id := 207;
t_forecast_interface_tab(1).forecast_date := TO_DATE('12-FEB-01');
t_forecast_interface_tab(1).bucket_type := 2;
t_forecast_interface_tab(1).quantity := 100;
t_forecast_interface_tab(1).process_status := 2;
t_forecast_interface_tab(1).confidence_percentage := 100;
t_forecast_designator_tab(1).organization_id := 207;
t_forecast_designator_tab(1).forecast_designator := 'SK-FORECST';
t_forecast_interface_tab(2).inventory_item_id := 3921;
t_forecast_interface_tab(2).forecast_designator := 'SK-FORECST';
t_forecast_interface_tab(2).organization_id := 207;
t_forecast_interface_tab(2).forecast_date := TO_DATE('19-FEB-01');
t_forecast_interface_tab(2).bucket_type := 2;
t_forecast_interface_tab(2).quantity := 150;
t_forecast_interface_tab(2).process_status := 2;
t_forecast_interface_tab(2).confidence_percentage := 100;
t_forecast_designator_tab(2).organization_id := 207;
t_forecast_designator_tab(2).forecast_designator := 'SK-FORECST';
t_forecast_interface_tab(3).inventory_item_id := 3921;
t_forecast_interface_tab(3).forecast_designator := 'SK-FORECST';
t_forecast_interface_tab(3).organization_id := 207;
t_forecast_interface_tab(3).forecast_date := TO_DATE('26-FEB-01');
t_forecast_interface_tab(3).bucket_type := 2;
t_forecast_interface_tab(3).quantity := 200;
t_forecast_interface_tab(3).process_status := 2;
t_forecast_interface_tab(3).confidence_percentage := 100;
t_forecast_designator_tab(3).organization_id := 207;
t_forecast_designator_tab(3).forecast_designator := 'SK-FORECST';
t_forecast_designator_tab);
commit;
end;
/*=======================================================================*/
You can verify the success by running the followin script, or by going to forecast entries screen.
fct.inventory_item_id ITEM_ID,
decode(fct.bucket_type,
1,'Days',
2,'Weeks',
3,'Period') BUCKET,
decode(mtl.ato_forecast_control,
1,'Consume',
3,'None') FCST_CONTROL,
forecast_date FCST_DATE,
current_forecast_quantity CURQTY,
original_forecast_quantity ORIGQTY,
transaction_id TRAN_ID
mtl_system_items_kfv mtl
ORDER BY forecast_date;
SK-TESTITEM01 3921 Weeks Consume and Derive 12-FEB-01 100 100 85525
SK-TESTITEM01 3921 Weeks Consume and Derive 19-FEB-01 150 150 85526
SK-TESTITEM01 3921 Weeks Consume and Derive 26-FEB-01 200 200 85527