Rahul
Go through the below link which contains some examples for yourself. Thereafter you can explore more when once the principal is clear.
Advanced Macros - Planning Book Design - SAP Library
If this already answers your question follow How to close a discussion and why as usual.
Regards
Rahul