Supply Chain Management Blogs by SAP
Expand your SAP SCM knowledge and stay informed about supply chain management technology and solutions with blog posts by SAP. Follow and stay connected.
cancel
Showing results for 
Search instead for 
Did you mean: 


In standard, when running a Product Heuristic like SAP_PP_002, shortages inside the PP/DS Horizon are planned even if the PP/DS Horizon is set to 0 days.

 

I've come across a few customers who would prefer to have the Location-Product filtered out from the heuristic execution and/or planning run in this scenario, therefore I created a sample code to be used in BAdI /SAPAPO/RRP_HEUR_DO, Method BEFORE.

 

While this is not a standard solution, it can easily be implemented, tested, and adjusted to suit your requirements.

 

Example:

Today is 13.02.2016.

 

PP/DS Horizon has been set to '0' for Planning Version TEST in /SAPAPO/MVM and for Product FERT at Location 0001 in /SAPAPO/MAT1.

 

It ends on 12.02.2013 23:59:59.

 

There is a forecast within the PP/DS Horizon, in the past:



 

 

Once Planning of Standard Lots is executed, a Planned Order is created, as early as possible, to cover it:



 

 

Template below excludes from the pegging areas to be planned those for which the PP/DS Horizon ends before or at the current date and time, when the heuristic to be executed is a Product Heuristic (SAP_PP_002, SAP_PP_003, etc):

 

 

method /SAPAPO/IF_EX_RRP_HEUR_DO~BEFORE.

 

DATA: ls_pegid     TYPE /SAPAPO/OM_PEGID,

ppds_horizon TYPE TIMESTAMP,

lv_now       TYPE TIMESTAMP.

 

" The BAdI only affects heuristics which can be marked as Product Heuristic  

CHECK i_heurfunc-prod_heur IS NOT INITIAL.

 

LOOP AT i_object_keys-pegid_tab into ls_pegid.

CALL FUNCTION '/SAPAPO/DM_PEGID_GET_MATERIAL'

EXPORTING

iv_pegid        = ls_pegid

IMPORTING

ev_ppds_horizon = ppds_horizon

EXCEPTIONS

OTHERS          = 4.

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

 

GET TIME STAMP FIELD lv_now.

 

" Compare Current Date and Time with PP/DS Horizon, in UTC

IF sy-subrc = 0 and ppds_horizon LE lv_now.

DELETE i_object_keys-pegid_tab WHERE pegid = ls_pegid.

ENDIF.

 

ENDLOOP.

 

   endmethod.

 

 

Once the BAdI implementation is active, the heuristic is terminated for the material, if you run it at the Product View:



 

 

The pegging area will also be filtered from the heuristic in planning runs (/SAPAPO/CDPSB0, /SAPAPO/BACKGROUND_SCHEDULING), though the step will be successful if there are objects to be planned (which were not filtered).

 

 

If an information or warning message is required, to alert planners of the materials which were not planned due to the BAdI, FM /SAPAPO/DM_PEGID_GET_MATERIAL can be used to determine the Product Number and Location for the pegging area.