STechno

SAP Function OIJP_SAFETY_STOCK_ROUTINE - IS-OIL TSW : SAP supplied dynamic safety stock calculation routine

IMPORT
Parameter Reference Type Length Default Optional Text
I_END_DATE SYST-DATUM D 8 X Date and time, current (application server) date
I_OIJLOCMAT_WA OIJLOCMAT u 608 Loc. material master data work area
I_SFT_STK_ABOVE_MIN C C 0 ' ' X Flag (X=add safety level to min. level)
I_START_DATE SYST-DATUM D 8 X Date and time, current (application server) date

EXPORT
Parameter Reference Type Length Text
E_SAFETY OIJLOCMAT-SAFETY P 7 Safety stock level

TABLES
Parameter Reference Length Optional Text
I_OIJCOV_TAB OIJCOV 8 Internal table for OIJCOV
I_OIJSCAL_TAB OIJSCAL 20 Internal table for OIJSCAL
I_TFACD_TAB TFACD 61 Internal table for TFACD
T_OIJCONSTYPE_TAB OIJ_CONS_TYPE 8 X Table type for Time dependent target and safety stocks
T_OIJTCONS_TAB ROIJTCONS_OUT 83 X TSW ALV output struc. for time dependent planning constraint
T_TGTSFTTIME ROIJTGTSFTTIME 22 X Table type for Time dependent target and safety stocks

EXCEPTIONS
Exception Text
PARAMETER_ERROR Parameter error
SAFETY_STOCK_FAILED Safety Stock Failed

DOCUMENTATION

Functionality
This function module calculates safety stock for the supplied
location-material.
It gets the following data for for the given location-material.

  • Calendar profile

  • Factory calendar ID

  • Coverage profile

  • It also gets all the historical data from OIJRD table for the
    location-material and stores it in an internal table l_oijrd_tab.
    clear: TOT_STD_DAYS, TOT_ISSUES.
    The following steps calculate the safety stock for the given
    location-material.
    Get the next entry from the internal table l_oijrd_tab
    Call the function 'DATE_COMPUTE_DAY' to get the day number of the date
    Call the function 'OIJP_CHECK_HOLIDAY' to check whether the current date
    is a holiday or not.
    If it is a holiday, then go to step 10
    If it is not a holiday, then go to step 6
    Call the function 'OIJP_FILL_STANDARD_DAY_RATIO' to get the standard day
    ratio for the date. Let it be SD_RATIO
    TOT_STD_DAYS = TOT_STD_DAYS + SD_RATIO
    TOT_ISSUES = TOT_ISSUES + L_OIJRD_TAB-IRACT
    Increase the counter COUNT by one
    If COUNT >= i_oijlocmat_wa-histhoz then goto step 11 else goto step 1
    Call the function 'OIJP_CALCULATE_INF' to calculate inflation factor.
    Let it be INF_FACTOR
    Adjust standard day using inflation factor
    ADJ_STD_DAY = TOT_STD_DAYS / INF_FACTOR
    Compute standard day issue
    STD_DAY_ISSUE = TOT_ISSUES / ADJ_STD_DAY
    If service level is initial for the location-material then take it as
    100%, otherwise take the actual defined in the master data
    Adjust standard day issue(L_ASDI) with service level
    L_ASDI = ( STD_DAY_ISSUE * SERVICE_LEVEL ) / 100
    If coverage period is initial then SAFETY = L_ASDI
    else SAFETY = L_ASDI * (coverage period).
    Determine correct safety level using the top-up flag
    if i_sft_stk_above_min = true then
    SAFETY = SAFETY + OIJLOCMAT-MININV
    If Calculated safety stock (SAFETY) is less than minimum inventory
    (OIJLOCMAT-MININV) then make minimum inventory as safety stock for the
    specified location-material, as below.
    SAFETY = OIJLOCMAT-MININV
    If calculated safety stock (SAFETY) exceeds maximum inventory
    (OIJLOCMAT-MAXINV) then make maximum inventory as safety stock for the
    specified location-material, as below.
    SAFETY = OIJLOCMAT-MAXINV

Based on SAP ECC6.