Without writing CMOD coding get the difference of Month ,Day and Year.
Scenario : We are many scenario where we need to calculate no of days/month/years from given date range or month/year range.
Our fast approach is to write a CMOD and calculate the difference…. But best approach is to avoid code help…
A Difference of month based on the user input interval on the variable selection screen.
Say for Eg: if user input is 01.2012 to 03.2013 so the difference would be 15 Months.
So now i will going to sharing the same approach with step by step method:
Step 1 : Create a new formula —> Under that you have folder named as formula variable :–>Right click on it :
–>New variable:Given the details as wrote below.
created on DIFF Month , choose time characteristic based on your requirement.
Give description and technical name .
Type of Variable : Formula
processiing by Replacement path.
Reference characteristic : 0calmonth.
Step 2 : click replacement path tab and give the details .
Replacement variable with : Variable.
Variable : 0I_CALMO (for month difference ) and 0I_DAYIN (for day difference) and 0I_CALYEAR (for year difference).
and reference characteristic : DATE characteristics.
processiing by Replacement path.
In theUse interval section choose Difference radio buttn.
Step 3:
In the currency/Unit tab choose dimension as Number.
Step 4:-Save this formula variable and Drag and drop into formula.Refer the screenshot.
Save the query and now let’s execute the query and check the results.
So as you can see that based on the input in variable selection screen we got the difference of Months.
Hope this might be useful.
Hi Sandeep,
Thank you for sharing , it will be helpful for us without using code.
Regards,
Giri
thanks lot giri peram
Regards
Sandeep
Thanks Sandeep,
Step 3:
In the currency/Unit tab choose dimension as Number.
Screen is repeated,
Please clarify.
Hi Amir,
Thanks Amir for ur Suggestion.
Regards .
Sandeep
Good Work Sandeep.Helpful one
Thanks karthick for your cheerful comments.
Regards,
sandeep
Great document. can you tell me a real time scenario where we need to calculate difference in date/month from user input.
Check out my blog for it.
http://scn.sap.com/community/business-explorer/blog/2013/08/28/formula-variable-demystification
Regards,
AL
I also note that Step 3 onwards had been copied word for word (except for the step numbers) from your blog.
hi harshawardhan,
You need to calculate some personnel metrics like equivalent labor class The formula is to take the the total number of absences and divide by the number of available work days (the client doesn't have the system calendar set to give work days, and they change the number of work days at report execution time
Regards
sandeep