cancel
Showing results for 
Search instead for 
Did you mean: 

using todays day in macro calculation

Former Member
0 Kudos

Hi Experts,

I want to create macro in which I want to use today's day (if today is 15th then today's day =15. For tomorrows calculation it will be 16). Kindly let me know which function module i have to use  for the same.

Also I want to use total days in month for calculation. please let me know the function module for the same .

Thanks in advance.

Regards

Sachin

Accepted Solutions (1)

Accepted Solutions (1)

former_member453166
Participant
0 Kudos

I believe you can just use the following to output the day within the month based on your requirement.  The TODAY function returns today's date in an integer w/r/t 0001/01/01 and the DAY function returns the day of the month.

DAY ( TODAY )

This is as per the below link on SAP help to date functions in macros:

http://help.sap.com/saphelp_scm50/helpdata/en/1d/310eb0d0ee11d4b2e40050da385632/content.htm


Former Member
0 Kudos

Hi,

Thank you for quick solution. I want to do sum of monthly forecast. It should seen monthly forecast in each day. Currently it is showing sum correctly on 1st. However it increases day in next period (for 5th it does sum from 5th to next 5th)

my requirement is sum of first month should seen in all day in first month and sum of second day should seen in all days of second month.Kindly let me know the macro for the same.

Regards

Sachin

Former Member
0 Kudos

Hi,

Thank you for quick solution. I want to do sum of monthly forecast. It should seen monthly forecast in each day. Currently it is showing sum correctly on 1st. However it increases day in next period (for 5th it does sum from 5th to next 5th)

my requirement is sum of first month should seen in all day in first month and sum of second day should seen in all days of second month.Kindly let me know the macro for the same.

Regards

Sachin

Answers (1)

Answers (1)

former_member453166
Participant
0 Kudos

For total days in the month, that's a little trickier using the standard macro functions.  However, it seems it is possible.  I haven't tested this yet in my sandbox client but if you are looking for the number of days in the current month, the macro should be something like this:

MONTH_EDATE( MONTH (TODAY) ) - MONTH_BDATE( MONTH (TODAY) ) + 1

You are taking the end of the month in integer format minus the beginning of the month in integer format, but since that will produce a value of 1 less than the total days in the month (i.e. 31 minus 1 = 30), then you can always add one at the end.