Tuesday, June 2, 2009

Note 412429 - Defining jobs with macros

Summary

Symptom
  • You have defined macros and you execute them in a background job, for example. It appears that these marcos produce incorrect results (or no results at all). If, however, you run these macros in interactive planning, everything works correctly.
  • (Apparently,) no historical data is saved.
  • The system does not issue the message "Data saved", although you would expect it to.
Other terms

Mass processing, macro, job, background

Solution

Ensure that you have taken the following points into account:

  • You can define both start and default macros in interactive planning and these, of course, are automatically executed before all other macros. If your user-defined macro accesses data that is only available when these start or default macros are executed, then it works correctly in interactive planning. However, it is essential that you take this dependency into account when defining the corresponding background job. This means that you must ensure that all macros that provide your macro with data are executed in the background job before your user-defined macro is executed. You must ensure that the sequence is correct, because, obviously, a macro cannot return correct (output) data if the correct (input) data was not available.

Therefore, when you define the background job you must specify which start or default macros must run in which sequence to ensure that your user-defined macro can function correctly.

  • If your historical data is ready for input and you also want to change data in the past, you must implement Notes 350061, 386089, and 387486 in your system. All three corrections are delivered as of Support Package 11 (APO Release 3.0).
  • You execute a macro for a second time (it was previously executed in the background or directly in interactive planning) so no data changes. Therefore there is no data to save either. As a result, the message "Data saved" does not appear in the log either.

In other words, the system only issues the message "Data saved" if new data is actually saved.

  • If a macro runs successfully in the background, this is recorded in the log with a corresponding message (with a green traffic light).

If data is saved successfully, this is also recorded in the log with a message (with a green traffic light). The system does not issue this message if an error occurred or if the situation described above occurs.

  • You must select the correct aggregation level when you define your job. That is the level that contains the required data. This is particularly important for key figures that are not aggregated. If you select the incorrect level (for example, a level that does not contain any data), then your macro cannot access any data either.
  • If you defined navigation attributes for one or more characteristics in your planning object structure, then you must also take them into account when you select the aggregation level.

If Note 591112 is on your system (the note is automatically included as of SCM 4.0), then the system does not automatically add the navigation attribute to the selection of aggregation level, if you selected the relevant characteristic as a detail characteristic. The reason for this is that there may be considerable performance problems if you have defined a large number of navigation attributes.

We therefore recommend that you only enter navigation attributes in the aggregation level in the following situations:

    • You want the hit list to be grouped according to the navigation attribute (in this case, you do NOT select the related basis characteristic).
    • The navigation attribute is used in the selection (for performance reasons, we recommend that you also include the navigation attribute in the aggregation level, see also Note 374681).
    • The related basic characteristic is selected and the navigation attribute is used, for example, in the execution of the macro (such as ACT_IOBJNM_VALUE, AGG_LEVEL, DET_LEVEL, DRILL_DOWN, DRILL_UP, and so on). For performance reasons, you should include the navigation attribute when you define the aggregation level, so that the system does not need to read the characteristic values of the navigation attribute during the execution of the macro.
  • Note that the system does not save user-defined auxiliary key figures, this means that when your job calculates auxiliary key figures in macro A, these can be used in macro B (which is executed after macro A). However, these auxiliary key figures are not saved. Thus, they cannot be displayed later in interactive planning, for example.
  • In APO 3.0, it is only possible to save time series key figures in the background. Saving order liveCache key figures in the background is not supported. It is only possible to save order liveCache key figures in the background as of APO 3.1 (using a batch job). You must bear this in mind when you schedule a macro in the background.
  • You cannot use macro functions that change cell, row or column properties (such as CELL_BG, ROW_VISIBLE, and so on) in a macro that runs in the background. This is obvious, because cell, row or column properties cannot be saved. If you use attribute functions in background processing, however, the system issues warning message /SAPAPO/ADV 100: "It is not possible to use function "macro function" in background processing". The system usually continues processing the macro, but you notice a certain drop in performance due to the unnecessary function calls.


One important example where problems may easily occur are alert macros. It is extremely important that you consider all of the points mentioned above when you define your job. Otherwise, your alert macros may not work correctly and in some cases there may be no alerts.

And of course, the points mentioned apply for all other macros too.

Header Data



Release Status:Released for Customer
Released on:20.02.2006 13:07:14
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

546079 - FAQ: Background jobs in Demand Planning

539797 - Collective consulting note on macros

521639 - Generation of DB Alerts in Background

495166 - Tips and Tricks for Handling Alert Monitor

No comments: