cancel
Showing results for 
Search instead for 
Did you mean: 

How to write an algorithm in APO DP

Former Member
0 Kudos

Hi All,

I would like to write an algorithm in DP (APO).

How to write the an algorithm program in APO>

Please let me know.

Regards,

Raju

Below is the requirement

Level of calculation:

Algorithm calculation is done at product * point of sales level.

Calculation periodicities:

Calculation could occur several times a day according to needs. It could be triggered automatically for process waves at fixed hours per country and triggered manually by client.

*Calculation logic:*

When the calculation is launched for a selection, the development should:

1. Check if values already exist in key figure set ‘theoretical’ for the day calculation is launched. If so no calculation is ran otherwise the development moves to step 2

2. Check if a valid forced threshold value is maintained at product * point of sales combination for the day calculation is launched.

If so no algorithm calculation is ran and the development copy, for product * point of sales combination, the forced threshold value in a key figure named ‘Theoretical Forced threshold replenishment order quantity’ otherwise the development moves to step 3

3. Check if product is assigned to a Products group. If so, this group will be considered in calculation step, otherwise, default product group will.

4. Check if point of sales is assigned to a Points of sales group. If so, this group will be considered in calculation step, otherwise, default point of sales group will.

5. Check if for each Products group * Points of sales group combination valid parameters values exist for the day calculation is launched. If so calculation is ran and the result is stored in a key figure named ‘Theoretical replenishment order quantity’ otherwise Products group * Points of sales group combination is recorded in a log as an anomaly

Calculation results are saved into DP time series. For one product * point of sales * date combination, only one of these 2 key figures will contain a value.

Data and horizon used in algorithm

The algorithm calculation is done for the current day, based on real DP historical values of last 14 days and algorithm parameters.

DP historical values are stored in key figures set ‘Validated’ (4 key figures: Sales, Rents, Transit and Stock)

Algorithm parameters are stored in tables described in previous chapter.

If there are missing data in the past for key figures set ‘Validated’, anyway the calculation is done.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I am assuming that the data points you are talking about already exist in a TimeSeries Planning Area. If not ... you need to SCM-APO-DP Setup of Planning Areas, possibly InfoCubes with the Characteristics and KeyFigures you want.

- Include in your Planning Area ... Dummy TEMP Keyfigures for the temporary calculations you need to do to check and compare KFs as mentioned in your Logic. I'd suggest 5 of them which can be reused for multiple stuff. Having KFs help in Debugging Macro Logic as you run it step by step and can see the value of the KF in the view thru Inter. Plng.

- use /sapapo/sdp8b to first create a Planning Book view of the Historical and Future Periods you need. Include all the Keyfigures including the TEMP Keyfigures (as hidden rows).

- Create a DP Macro in this Planning Book as per the Logic. This should cover most of your requirements.

- You've mentioned you need to write Custom Logic because you need to use data in 'Tables' (I am assuming Z). If so either you have to write a UserExit Macro (BADI) in ABAP and need a ABAP Developer for it. Alternatively you can try & see if instead of the Z Table you can use the 5 'Extra Fields' in the Product-Location Master in 'Extra' Sheet in /sapapo/mat1 to store the same information which I am assuming will be for a Product-Location combination. The Std. DP Macros can get data from these Fields using Macro Functions. The UserExit / BADI Macro is not easy to Code.

Hope this helps. Reward points if it does.

Regards,

Ambrish

Former Member
0 Kudos

please list valid parameters as in step 5..will try to develope macro logic

Former Member
0 Kudos

It means you will require to write macro