Background
The Macro Builder in SAP APO is extremely difficult to interpret. One reason for this is that the Macro Builder uses functions, which are not explained within the Macro Builder itself.
For instance, when looking at the Days Supply macro, the function Cover_Cal( is used. This macro compares stock to demand in order to calculate how many days of supply are planned to be held for each period.
In order to understand macros, its important to have access to the functions that can be used in the macro. For SNP, these functions can be found at the link below.
Functions
The SNP functions are listed here.
http://help.sap.com/saphelp_scm50/helpdata/en/77/9aa339a28e0554e10000000a114084/content.htm
For instance in the standard Days Supply macro which is shown in this article uses the Cover_Cal( function as the main function in the macro. Full details exist at the link provided above, however, it is extremely difficult to understand can can take an hour to fully interpret. All the definitions are like this in SAP and really need to be translated into standard English. In fact I worked on a project where the client created definitions of each standard SAP macro and custom macro that they use. This is a good decision, because the Macros themselves are difficult to understand.
This returns the days supply of a product by considering the current stock on hand, the total demand of subsequent time periods, and the number of workdays in this time period. – SAP Help
Operators
In addition to functions, the Macro Builder can add operators. As with functions, these are added to the Macro Builder with the operator/function icon.
http://help.sap.com/saphelp_scm50/helpdata/en/f3/852d3af6ecd02ae10000000a114084/content.htm
These operators are listed below:
http://help.sap.com/saphelp_scm50/helpdata/en/1d/310ea4d0ee11d4b2e40050da385632/content.htm
Some of them are exactly as one would expect, however, one which is not intuitive is the “;” which is a separation between arguments. Overall the operators are very deep in functionality. In addition to mathematical operators SAP has several other types including statistical.
http://help.sap.com/saphelp_scm50/helpdata/en/1d/310ea7d0ee11d4b2e40050da385632/content.htm
Within the statistical operators there are standard forecast error calculations including MAD, MAPE and MSE.
Boolean functions allow for coding like capabilities are are listed here.
http://help.sap.com/saphelp_scm50/helpdata/en/1d/310eaad0ee11d4b2e40050da385632/content.htm
The number of functions and operators is quite overwhelming, and after reviewing them, it seems that most any calculation is possible within a macro. The functions could be documented more clearly, but the documentation in the links listed in this post is very extensive. Something which I really liked was the link placed within the descriptions, that takes you out to the business purpose of the technical subject.
This way the reader can go directly to the business purpose.
The function/operator icon is also used to create an open and closed parenthesis.
Row Selection
The Key Figures that the macro works off of are called “Rows” in the Macro Builder. They can be added by dragging them from the Elements area.
They can also be changed by right mouse clicking and selecting Properties.
Once in properties, different Key Figures can be selected and can substitute for the original Key Figure.

After you are finished editing the macro, it needs to be activated and generated.
One of the major issues with macros is that the Key Figures are relative. Therefore if a new Key Figure is added to a Planning Book, the macros need to be checked, because they will refer a specific row in the Planning Book. The Key Figure can be changed by selecting them and changing them.
The main rule is when you add Key Figures, they need to be added at the bottom of the Planning Book. When moving them up, all of the macros below that Key Figure must be checked, because the Key Figures that are used in the macros will change.
Conclusion
Macros have very deep functionality with respect to functions and operators. While the Macro Builder is not intuitive or easy to understand already build macros, with research into the SAP documentation, they can eventually be figured out.