cancel
Showing results for 
Search instead for 
Did you mean: 

Default Macro calculation on the specific aggregated level in DP

Former Member
0 Kudos

Dear APO Gurus,

There is a simple macro to calculate forecast in values:

Forecast in Values = Forecast in PCs * Price

Now price is always maintained on the level of Material and sales org. It means forecast (in values) should be calculated on the aggregated level of characteristics "Material" and "Sales Org".

I know we can set the aggregation level (Material - Sales organization) in the DP background job to perform the macro calculation.

How I can create a default macro which always make calculation on the level of selected characteristics: (e.g.Material and Sales org). Planner may load the data on group level (many materials at once) in the data view, but default macro will make calculation always on the fixed aggregated level (Material - sales org)

I will appreciate if you can provide an example macro in macro bulider.

Thanks in advance and nice weekend.

Regards,

Mukesh

Accepted Solutions (1)

Accepted Solutions (1)

peter_casper
Contributor
0 Kudos

Hi Mukesh,

create a macro which pre-condtion is the check of the desired aggregation level.

Example in pseudo code:

IF agg_level ("Sales org" = 0 AND "Matnr" = 0)

     Forecast in Values = Forecast in PCs * Price

ENDIF.

The whole thing works with agglevel but as well detailed level.

regards Peter

Former Member
0 Kudos

Hi Peter,

Thanks for your reply. In this solution, default macro will calculate the result (Forecast in Values) only when data is loaded on the detailed level of material and sales organization. Taking the example from following table, macro will work when planner will load the data for material P1 for sales org UK.

In the real world scenario, planner may load the forecast data for all materials together in the data view (P1+P2+ P3+P4 = 100PCs). In such case how to make sure default macro will make calculation on the detailed level of material and sales organization which gives result of Forecast in values = 300

Kind regards,

Mukesh

peter_casper
Contributor
0 Kudos

Hi Mukesh,

therefore I would use a background job to perform the calculation on the expected level instead of doing it online. Not sure how often the price changes but I would strongly assume that prices will not be loaded more often than once a day. Therefore a nightly recalculation after having loaded updated prices should be sufficient.

However you might also trigger a background job via userexit/badi macro in case you really want to perfrom this activity online or you use the drill_down and drill_up function to do the same. But you need to keep in mind that this kind of procedure impacts the dialogue usage and runtime.

regards Peter

Former Member
0 Kudos

Thanks Peter.

Nice weekend.

Answers (1)

Answers (1)

former_member187488
Active Contributor
0 Kudos

Hello,

When necessary, you can use internal drill down/up macro function drill_down() / drill_up().

Best Regards,
Ada