Tuesday, June 2, 2009

Note 433166 - MacroBuilder: Use of DRILL_DOWN, DRILL_UP functions

Summary

Symptom

You use the macro functions DRILL_DOWN() and/or DRILL_UP() in your macros. One or several of the following symptoms occur:

    1. After execution you get unexpected results.
    2. Executing a macro where the function DRILL_DOWN() or DRILL_UP() is used causes runtime problems.
    3. You run the macros in interactive planning (TA /SAPAPO/SDP94). The macros work as desired without any errors. If you schedule the same macros in a background job, the macros provide completely different results or a short dump occurs.
Other terms

Macrobuilder, /sapapo/advm, Interactive Planning, /sapapo/sdp 94

Reason and Prerequisites

Incorrectly defined macros.

Solution

Adapt the definition of the macros used, taking the following points into account:

Note, in general, the following: When macro functions DRILL_DOWN() and DRILL_UP() are executed, the system internally carries out the same actions as when a user chooses the navigation functions "Details all" and "Total" using the header information for a characteristic in interactive planning. This also includes the execution of all default and level change macros.
However, note the additional remarks regarding macros in background further below in this note.

For 1. and 2.

  • Make sure that the functions DRILL_DOWN() and DRILL_UP() are only called if the current planning situtation allows the relevant action. A check makes sense as to whether you are currently on an aggregated level or a detailed level for a characteristic. The check can be carried out using macro function AGG_LEVEL() (see the documentation and the delivered macro information 9AEXAMPLES (MacroExamples)).
  • Make sure that the functions DRILL_DOWN() and DRILL_UP() are not executed repeatedly after each other by mistake. This also includes ensuring that the macro properties are maintained correctly and that the macrofunctions DRILL_DOWN() and DRILL_UP() are executed only once within a macro step (the macro step must have one iteration only).
  • We urgently recommend that you put macro functions DRILL_DOWN() and DRILL_UP() in individual macros, thus separating them from the actual calculation. This is always possible on principle. Instead of one single macro which carries out the actions drill-down, calculation 1, drill-up, calculation 2 for example, you should define five macros in total. One collective macro and four partial macros executing the above-mentioned actions drill-down, calculation 1, drill-up, calculation 2. Define the collective macro so that it calls the four partial macros one after the other.
  • Never execute functions DRILL_DOWN() and DRILL_UP() in a default or level change macro.
  • In a situation including several planning objects (drilldown for at least one characteristic), make sure that data changes are not implemented simultaneously on different hierarchy levels. For example, aggregate data and details must not be changed at the same time. This is required to prevent inconsistencies.
  • Check whether your intended logic has been displayed by the existing macros: Instead of using the functions DRILL_DOWN() and DRILL_UP(), execute the required navigation and macros manually (this is easily possible, if you considered the above recommendation and put the macro functions DRILL_DOWN() and DRILL_UP() in separate macros). Only add the functions DRILL_DOWN() and DRILL_UP() (refer to points 1 and 2) when this 'manual' process has achieved the required result.
  • Compare the performance of the macro execution with the performance of the 'manual' process. Execution by macro should be slightly faster than 'manual' execution.
  • You can, for example, increase the performance in the scenario; drill-down, calculation, drill-up, by calling up the macro functions DRILL_DOWN() with the additional optional parameter 'INTERNAL'. In this way, the sending of data to the GUI after executing the macro function DRILL_DOWN() that is not needed later on is prevented, since at the end of the scenario another drill-up is made and the details never need to be displayed in the GUI.


For 3.

To use of the macro functions DRILL_DOWN() and DRILL_UP() in macros which are to be executed in batch, additional, stricter conditions apply beyond the notes above. Ensure that the following points are observed when defining your macros:

  • You have read and observed Note 412429 in the definition of your macros.
  • Within a job, data can be changed and saved on only one hierarchy level. It is generally NOT possible to change and save data on different hierarchy levels within a single job. This strongly restricts the use of the macro functions DRILL_DOWN() and DRILL_UP(). After changing data on a certain hierarchy level, the hierarchy level must not be changed by executing the macro functions DRILL_DOWN() or DRILL_UP() under any circumstances.
  • The use of the macro function DRILL_UP() in background does not make sense. The only imaginable scenario would be drill-up, calculation. Instead, a job definition is recommended that uses the aggregate level directly, so that no drill-up is required before the calculation.
  • To use the macro function DRILL_DOWN() in background, there is only one practical scenario, that is drill-down, calculation. Contrary to the drill-up scenario, this drill-down scenario can thoroughly be practical, for example in the following situation:

You have the characteristics LOCATION and PRODUCT and the two following characteristic values combinations exist:

L1, P1

L1, P2

You want to execute calculations on a detailed level (LOCATION and PRODUCT). There are two possibilities for this. To explain these, let us suppose you have defined three macros. One macro CALCULATION that executes the desired calculations, one macro DRILL_DOWN that only executes the drill-down for PRODUCT and one collective macro COLLMACRO that first calls up the macro DRILL_DOWN and then the macro CALCULATION.

      a) You define a job that is to work on a detailed level (LOCATION and PRODUCT) and execute the macro CALCULATION. Then the processing in background is done in such a way that the macro CALCULATION is executed for every characteristic combination one after another.
      b) You define a job that is to work on the level LOCATION and to execute the macro COLLMACRO.

In this case, the macro COLLMACRO is called up once, that is on the level LOCATION. Then, a drill-down by PRODUCT is done, so that the macro CALCULATION has access to all detailed data and processes them internally step by step. In this way, a performance gain can be achieved, because the job needs to call up the macro only once with a single characteristic combination and everything else is processed internally by the macro itself.

In addition, the macro CALCULATION is provided with the data for the two products P1 and P2 at the same time, and it can access both. This allows for the realization of more complex calculations than in the first case.

  • Always use the macro function DRILL_DOWN() with the additional, optional parameter 'INTERNAL', if the macro is to be executed only in the background.
  • The restrictions that apply for use of the macro functions DRILL_DOWN() and DRILL_UP() in macros executed in the background can be avoided by appropriate definitions of the jobs and the respective macros. For this, define macros which conform to the restrictions above. Use the macro function DRILL_DOWN() only when it is absolutely necessary (see above). Note that the macro function DRILL_DOWN() must never be executed after a calculation on a certain level within one job.

If you want to execute calculations on different levels, use several jobs and define the level on which you want to work already in the job itself. If you have to comply with a certain processing order, concatenate the different jobs by defining the completion of the desired predecessor job as the start condition when scheduling a subsequent job.

  • Ensure the aggregate level of the job has been defined appropriately when you use the DRILL_DOWN() macro function in a background job. If you want to excecute a 'drill-down' on a certain characteristic in the background, under no circumstances can you select this characteristic when you choose the characteristics for the aggregate level. If you do select this characteristic, then the planning data relating to this characteristic is already read in detail when the background job is excecuted. Consequently a corresponding 'drill-down' is no longer possible.

Header Data



Release Status:Released for Customer
Released on:04.02.2005 12:38:01
Master Language:German
Priority:Recommendations/additional info
Category:Consulting
Primary Component:SCM-APO-FCS-MAC MacroBuilder
Secondary Components:SCM-APO-SNP-MAC MacroBuilder

Affected Releases

Software
Component
Release
From
Release
To
Release
And
subsequent
SAP_APO
30
30A
30A
SAP_APO
310
310
310
SCM
400
400
400
SCM
410
410
410
SCM
500
500
500
SCM
510
510
510

Related Notes




1045639 - Consulting notes in SNP/CTM

954223 - Mass processing: Not possible to run only at aggregate level

674238 - MacroBuilder: Start, final, level change and default macros

539797 - Collective consulting note on macros

495166 - Tips and Tricks for Handling Alert Monitor

No comments: