Create simple tools to test complex macros during development
When developing and testing complex macros, it is useful to be able to see what is going on behind the scenes. For example when performing a calculation and putting the results into a hidden key figure or a variable for use in a later macro step, it is often useful to see these interim results. Equally, when retrieving product master data to use in a macro it can be useful to see this data before it is used to ensure the correct data is being retrieved.
A simple technique to achieve this is to add temporary coding (either within a macro as additional steps or as a separate macro) to pop up relevant data. This has the effect of stopping the macro at each step and putting relevant data on screen in a pop-up box that can be checked before going on to the next step. Given that a data view often contains over 100 buckets, it is worth temporarily restricting the number of iterations that a calculation being investigated will work on – it saves a lot of keying.
Below is a very simple example
Here the requirement is to pop up the initial stock on hand so that a note of it can be made. Thus in step 1, the standard macro function is used to retrieve the data and in step 2, a message is created that pops up with this information. It’s a simple example that just puts up the contents of 1 key figure once although it is possible to put several pieces of information into the pop-up box.
Here is another example to pop up data in key figures that are not always easy to see on the data view being used:
Here an additional macro has been developed for the purpose of displaying the capacity consumption and planned production in a single pop up box.
After development, this temporary work can be completely removed. Alternately the relevant macros or macro steps can simply be deactivated in case they are needed in the future for debugging.