Formula Variable Demystification
A year and a half ago i came across a post in SCN where the requirement was to get the difference of days based on the user input interval on the variable selection screen.
Let’s say for Eg: if user input is 01.03.2012 to 13.03.2012 so the difference would be 13 days.
Most of the people suggested tryIing with code in cmod and i thought of exploring the options in BEx query designer itself.So after searching for a while i stumble across this Difference radio button in formula variable.I tried my hands out with it and achieved the desired result.
So now i will be sharing the same approach with detailed navigation on the same.
Step 1 –Create a new formula —Under that you have folder named as formula variable–Right click on it –New variable—Give the details as mentioned in below screenshot.
I have created on Actual GI date you can choose any other time characteristic based on your requirement.
Step 2—Hit the replacement path tab and give the details as per the below screenshot.
Give the technical name of variable created on date (User input variable) of type interval.
In the Use interval section choose Difference radio button
Step 3—In the details and default values tab nothing needs to be selected.
Step 4—In the currency/Unit tab choose dimension as Number.
Step 5—-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 days.
Hope this might be helpful and useful.