# How to derive Calmonth & Calyear from Calday easily in BEx

Introduction

This may be obvious topic in BEx. I believe “Replacement Path” processing type is the most smartest one which can avoid many User Exit variables, for which we break our heads to write Code to do our Trend Analysis. Hope you guys got now, what am I going to demonstrate in this simple blog.

Scenarios covered are :

1. Dummy KF to enable Selection in variable Screen
2. Calmonth from Calday
3. Calmonth from Calday (Range)
4. Calyear from Calday and Calmonth

The basic pre-requisite to derive above scenarios is a Calday Variable. This can be a “Single Value” or “Interval” as well.

Imagine below in my screen shots

Calday = Invoice Clearing Date

Calmonth = Invoice Clearing Month

1. Dummy KF to enable Selection in Variable screen

Why a dummy KF is required?

Let’s suppose we have a Calday variable in Filter or in Default Values pane in our query designer. This means, we are restricting globally our time period as per the variable entry, by which we cannot calculate for past or future periods. To overcome this, we have to bring our variable to KF pane by restricting to a dummy KF and hide the KF. Then this variable becomes local and appears on the variable screen which is our desire.

2. Calmonth from Calday

Suppose User enters Calday : 01.11.2013, then 11.2013 can be picked by creating a Replacement Path variable under Calmonth like below.

The offset length: 6 is the Key Parameter to pick up 11.2013 from 01.11.2013. This is some thing like we are considering only 6 Characters out of 8 characters through ABAP Code.

3. Calmonth from Calday (Range)

Suppose we have a Calday (Interval) : 01.07.2013 to 10.08.2013. Please observe To Date is a different month. Now we want to see our KFs as per From and To Dates.

I mean one of your KF has to show data for 07.2013  by based on From date and your Other KF has to show data for 05.2013 by based on To date.

Create two variables like Calmonth FROM and Calmonth TO by replacement path of Calday (Interval)Variable like below.

Finally you have to restrict your KFs with respective Calmonth FROM and Calmonth TO and apply Offset-3 to get 05.2013 like below. You can apply any Offset value for both variables. That’s How we can play with these derived variables.

After executing the report, you will get the result like below.

To cross check whether our two variables have really replaced our Interval variable or not, I have drill downed with Invoice Clearing Month(Calmonth). It shows correct months for the corresponding KFs, by which we can confirm that our mechanism works.

4. Calyear from Calday and Calmonth

Suppose we have Calmonth and Calday variables, we can derive Calyear by creating two separate variables by considering offset parameters like below.

Conclusion :

We can do many of our Trend Analysis by just using “Replacement Path” and applying Offsets for past and future periods. This will reduce unnecessary time spending on User exits. We should go with User exits unless they are really required.

### Assigned Tags

You must be Logged on to comment or reply to a post.

Nice Work.

Regards,

Sushant

Suman Chakravarthy K
Blog Post Author

Hi Sushant,

Thanks for the feedback ðŸ™‚

Regards,

Suman

Hello Suman,

Good and concise explanation of  'Replacement path'. Keep it up.

Anand Kumar

Suman Chakravarthy K
Blog Post Author

Good presentation and very well drafted about replacement path. Thanks for sharing suman.

Suman Chakravarthy K
Blog Post Author

Thank you Raman for your valuable feedback ðŸ™‚ ðŸ™‚ U r Welcome..

Nice Explanation Suman. Thanks for sharing ðŸ™‚ ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Nice Document Suman..... ðŸ™‚

Regards,

SM

Suman Chakravarthy K
Blog Post Author

Thank you Mishra for feedback ðŸ™‚

Hi Suman,

Very good informative and motivated doc.  It is really useful in so many scenarios.

Thanks for sharing Boss.  You are rocking. ðŸ™‚

Regards,

Krishna Chaitanya.

Suman Chakravarthy K
Blog Post Author

Made me to smile instantly ðŸ™‚ ðŸ˜† ðŸ˜† . Amazing comments. You say it is motivating as well. Thrilled to know that..

Regards,

Suman

Yessssssss...It doesnt matter who hurt you or broke you down.  What matters is who made you smile again.  ðŸ™‚ ðŸ˜‰   right?

Suman Chakravarthy K
Blog Post Author

Of course dude. Thanks for reading my blog ðŸ™‚

Nice Document ,Thanks for sharing

regards

Sandeep

Suman Chakravarthy K
Blog Post Author

Thank you Sandeep ðŸ™‚ for your feed back.

very well explained...

Thanks for sharing.. ðŸ™‚

Good one Suman...:)

Suman Chakravarthy K
Blog Post Author

Thank you Sandeep Chauhan, Prerna Rathore and Naveen Choudhary for your cheerful comments. ðŸ™‚ ðŸ™‚

Hi suman,

very well explained use of replacement path..thanks for sharing ðŸ™‚ .

Suman Chakravarthy K
Blog Post Author

nice work and clearly explained Suman!

Suman Chakravarthy K
Blog Post Author

Thank you Martin for nice feedback ðŸ™‚ ðŸ™‚ My intention is to make it crisp and clear. ðŸ™‚

I missed this one.

Useful and Thanks for sharing the document.Rated the document.

Cheers

KP ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Thank you Prashanth for wonderful comments ðŸ™‚

Nice and informative document.

Regards,

Shyamala.V

Suman Chakravarthy K
Blog Post Author

Thank you Shyamala ðŸ™‚

Off the record. Congrats suman becoming Diamond level. Its Wonderful journey along with you. Once again Congrats for you support to SCN.

Suman Chakravarthy K
Blog Post Author

I am delighted today to see Diamond(the ultimate level in SCN) tagged to my name. This is a really long journey. Thanks for your encouragement ðŸ™‚

Regards,

Suman

Congrats dude ðŸ™‚

This is for you.

http://hdwallpaper.freehdw.com/0001/nature-landscapes_other_flower-bouquet_3630.jpg

Expecting Party ðŸ˜‰

Suman Chakravarthy K
Blog Post Author

Hey Krishna,

This is really amazing gesture. ðŸ™‚ Thanks a lot for it.

Regards,

Suman

Congrats Suman ..... U deserve it ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Thanks a lot for your warm wishes Shyamala Kalluri  ðŸ™‚ ðŸ™‚ ðŸ™‚

Thats really informative Suman, Thanks a lot for sharing the info.

You have very well expalined it..!! ðŸ™‚

Regards,

Priyanka

Suman Chakravarthy K
Blog Post Author

Thanks for the cheerful comments and the valuable feedback Priyanka Jain ðŸ™‚ ðŸ™‚

Awesome piece of doc.

Suman Chakravarthy K
Blog Post Author

Thank you for your wonderful review Arshiyan -  ðŸ™‚ ðŸ™‚

Excellent Document,

Thanx for sharing Suman!

Suman Chakravarthy K
Blog Post Author

Thank you sudarshan reddy for your valuable feedback ðŸ™‚ ðŸ™‚

Hi Suman,

Nice exploration and explaination, as always ðŸ™‚

Thanks for sharing.

Regards,

Mohammed.

Suman Chakravarthy K
Blog Post Author

Amazed by your words Naveed ðŸ™‚ Thank you..

Hi Suman,

Thanks,

Chandresh Patel

Suman Chakravarthy K
Blog Post Author

Thank you Patel

Exceptional!!!! Please post RRI related also if possible!!!!

Br,

Ravi Kiran.

Suman Chakravarthy K
Blog Post Author

Thanks a lot Ravi for your cheerful compliments.

Simple and superb suman.

This document clarified lot of my doughts in using replacement path

1) How to create replacement path using variable.

2) How can we use "FROM & TO" options in replacement path

Nice thing here is, as a finishing touch you have used OFFSET very effectively in end of this document. gr8. Thanks.

Best Regards,

Venu Gopal

Suman Chakravarthy K
Blog Post Author

I am really delighted to read your line by line review. Fantastic kick to me ðŸ™‚ ðŸ™‚

Thanks a lot Venu.

Thank You Very much.... ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Welcome bl vijaykumar ðŸ™‚

Hello Sumanda,

regards,
Aparajit

Suman Chakravarthy K
Blog Post Author

Hi Aparajit Banik ,

Thank you for your feedback ðŸ™‚ BTW, my name is SUMAN

This is a very good document and it proves we can derive calmonth , calyear without using customer exit or abap code.Many thanks.

Suman Chakravarthy K
Blog Post Author

Thanks Saikat Pal for your amazing rating ðŸ™‚ ðŸ™‚ . Yes, Cust exits can be avoided if you are good in replacement paths and applying offsets.

you are an expert in bex. Excellent job. I dint know we can play around with this without abap code. wiz kid ðŸ˜€

Suman Chakravarthy K
Blog Post Author

Hi Daniel Ray ,

Thanks for the appreciation ðŸ™‚ ðŸ™‚ . Yep, Replacement path is the smart toy in bex.

Regards,

Suman

HI Suman,

Wonderful document never seen before.. ðŸ˜¯ . Clearly explained with step by step navigation. ðŸ™‚ ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Hi Praveen Raj ,

Thank you for the wonderful comments ðŸ™‚ Great feedback!!

Regards,

Suman

Suman! Great article! Thank you for posting it. Appreciate it! Not only did I learn about deriving 0calmonth from 0calday...I learned about you can play around with the system.

Regards,

Meghana

Suman Chakravarthy K
Blog Post Author

Thanks for your noble words. ðŸ™‚ Thrilled by your last comment ðŸ™‚ ðŸ™‚ .

Regards,

Suman

Suman Chakravarthy K
Blog Post Author

Hi Praveen Raj ,

It should work. Give a try..

Regards,

Suman

Suman Chakravarthy K
Blog Post Author

Good job!! ðŸ™‚ I am happy that my blog helped you.

Hi Suman,

One more very nice document from you. Shows great about how we can play around in bex. Thanks for sharing. ðŸ™‚

Suman Chakravarthy K
Blog Post Author

Thanks a lot for your splendid comments ðŸ™‚ . We can play around with replacement path in Bex.

Regards,

Suman

Hi Suman,

Good & Informative document, Cleared my doubts regarding the Offset.

Thank you very much.

Regards,

Anil.

Suman Chakravarthy K
Blog Post Author

Good information ...

Hi Suman,

Got to see your blog post today, I must say thhis is excellent way to avoid Custmer Exits.

Very well explained. looking forward for some more useful information from you.

Regards,

Vikrant

Suman Chakravarthy K
Blog Post Author

Glad to receive amazing feedback from you Vikrant Soni ðŸ™‚ ðŸ™‚ . User exits have to be avoided wherever it is possible by using replacement path and offsets.

Thank you for your feedback Laxmikanta Verma ðŸ™‚ ðŸ™‚

Best Regards,

Suman

Hi,

This is awesome, wonderful way to ignore cmod. Can you share some more thoughts on LYMTD & LYYTD using Replacement Path.

Keep rocking, people like you are always helpful to step us further in BW!!! ðŸ˜Ž

SumanT