cancel
Showing results for 
Search instead for 
Did you mean: 

Supply Shortage in SNP Heuristic

Former Member
0 Kudos

Hi gurus!

Tell me how i can disable the summation supply shortage in the SNP Heuristic run.

I tried to copy the planning book and edit macros, performing zeroing negative "Stoc on hand (projected)", but this led only to an inadequate needs calculation. Created only a first order, and further planning is not happening.

Accepted Solutions (1)

Accepted Solutions (1)

rajkj
Active Contributor
0 Kudos

Hi,

The heuristics engine creates a proposal if Stock on hand (Projected) falls below the Target stock level. Since you edited the macro and not allowed negative quantities, the stock on hand was calculated wrongly and hence, inappropriate results.

If your requirement is concerned with display of supply shortage, you can hide that key figure row (use t.code /sapapo/sdp8b and select your planning book as well as data view).

Thanks,
Rajesh

Former Member
0 Kudos

Thanks, Rajesh, for confirming my doubts about the incorrectness of changing the macro.

I understand what you mean, but hiding a row in my case is not enough.

I want to prposal, created by heuristics, not take into account Supply Shortage, in other words, has always created a need between zero and target stock level, but not including a negative supply.

Here is a sample of business case to describe the situation, I'm talking about: the delivery can be achieved only on day 10. Supply is reset on the fifth day. Yet there is a released forecast, which reduces the stock every day. After zeroing the stock,
supply shortage begins to accumulate. Proposal, founded on the tenth day will bring good to cover Supply Shortage (abs [stock on hand] which has already become negative) + Target Stock.

The product, in case of shortage. Pent-up demand is not there and the whole Supply Shortage will not be sold, when it was brought too late. The aim - to create an application from scratch is always a target Stock Level.

rajkj
Active Contributor
0 Kudos

Alex,

Thanks for the detailed description.

Pl. try the following macro update and hope it might work for you.

Thanks,

Rajesh

Former Member
0 Kudos

Rajesh, this was useful! But after following your advice, I again faced the problem in heuristics.

Here is the result of your macro in my system:

Initially, I tried to do something similar, here's my solution:

In practice, I got the following results:

There was the same. Heuristics do not create more than one order, despite the fact that the stock is below the target stock level.

Image below describes the differences between the standard scenario and what I want to get:

You suggested a shorter solution than what I did. But it's not all goals were met.
Is it even possible to achieve what I want, using only macros, or we need a different approach?

rajkj
Active Contributor
0 Kudos

Hi Alex,

Your screenshots were really helpful to understand what went wrong. Pl check the following screenshot of updated macro implementation. This should allow to decrement the stock on hand (proj) and subsequently allow the heuristics to generate orders.

Note: Stock on hand (Proj) calculations are based on standard implementation. Our customization is just related to introduction of IF condition and assigning 0 to negative stock on hand(proj) value.

Thanks,
Rajesh

Former Member
0 Kudos

As far as I know the functionality of macros is that within a step of calculating the results are not available for other operations.
That is, in your example, or when the IF condition is not satisfied, because value of the stock at the current step has not yet been received and it is actually still zero.

If I modify a macro by checking the previous day's supply at IF condition (ie, zeroing reserve late in a day) I was again faced with the problem in heuristic.

rajkj
Active Contributor
0 Kudos

I am not sure I got your point. However, it is possible to assign value to a row element and read it for further processing i.e. use of IF condition and update the value within the same step.

This can also be achieved through use of variables. The pseudo code

Step1: 1 iteration //initial column

//assign value to variable var1

LAYOUTVARIABLE_SET( 'VAR1' ; EVAL(

   INITIAL_STOCK(initial)

   +

   TOTAL_RECEIPTS(initial)

   -

   TOTAL_DEMAND(initial)

) )

IF( VAR1 < 0 )

     STOCK_ON_HAND(Proj) = 0

ELSE

     STOCK_ON_HAND(Proj) = VAR1

ENDIF

Step2: 1..n iterations //entire horizon except initial column

//assign value to variable var1

LAYOUTVARIABLE_SET( 'VAR1' ; EVAL(

   STOCK_ON_HAND(Proj) (initial)

   +

   TOTAL_RECEIPTS(8/10/12)

   -

   TOTAL_DEMAND(8/10/12)

) )

IF( VAR1 < 0 )

     STOCK_ON_HAND(Proj) = 0

ELSE

     STOCK_ON_HAND(Proj) = VAR1

ENDIF

Former Member
0 Kudos

Rajesh, I understand what you tell me. I am familiar with how to run macros. In one of my posts above on the side of my screen shot is an example of a macro, where I just use variables.

The fact that I have no problem with zeroing stock. I know at least three ways to write a macro for this. The problem arises when running heuristics, it creates only the first document (and does it absolutely correctly, up to target stock level), but more proposal are not generated.

I would like to know what this may be due. Maybe I did not realize so deeply the mechanics of heuristics. Maybe edit the macro - it is not the right way to solve my problem. May want to use any user-exit heuristics or something like that.

The aim is not only clear the stock, the goal of creating proposals up to the target stock level entire planning horizon.

If you can help me solve this problem, I'll be happy to address any options. Macros, user-exit, badi, anything else...

former_member187488
Active Contributor
0 Kudos

Hello,

I think I can understand what the problem is.

Heuristic planning runs like:

1) delete all unfirmed planned orders

2) calculate the supply shortage for the whole horizon according to the macro

3) calculate orders to be created based on the result of step 2)

The point is, macro runs only once before order creation in heuristic, instead of running bucket by bucket after order is created in a bucket.

In your case (with the sample macro), the step 2) ignores all supply shortage (this is because from the first supply shortage, all buckets are with negative stock, and the macros sets them to zero), thus ignores all forecast demands. So no order could be created for the forecast demands.

The way to acheive your expectation, I suppose, should be only ignoring the supply shortage when it first occurs. In order to acheive this, you may need a flag to make the macro ignore the supply shortage only once.

Hope this helpful.

Best Regards,

Ada

Answers (0)