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:

/wp-content/uploads/2016/02/01_886958.png

 

 

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

/wp-content/uploads/2016/02/02_886959.png

 

 

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_heurfuncprod_heur IS NOT INITIAL.

 

LOOP AT i_object_keyspegid_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 sysubrc <> 0.

CONTINUE.

ENDIF.

 

GET TIME STAMP FIELD lv_now.

 

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

IF sysubrc = 0 and ppds_horizon LE lv_now.

DELETE i_object_keyspegid_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:

/wp-content/uploads/2016/02/03_886960.png

 

 

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.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply