cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation of No.of days ?

Former Member
0 Kudos

Hi.

I have a attribute called Relase date. I want to calculate no.of days from the current date. In cube I have no Cal Day so I cannot calculate the no.of days in Be.x.

Thanks in advance.

sudhakar.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

1. In the new formula create a varibel with repalcement path in the operands side. Give release dt characteristic

as object and with 'key'. Drag this variable in the new formula. This should display release dates.

2.Now you have to write a customer exit for getting SY-DATUM. Use the following code.

Before that create a variable of type customer exit for system date on the same release date

object. (ex: ZSYSDT - not ready for input processing type customer exit)

DATA: W_I_T_VAR_RANGE_IN like RRRANGEEXIT.

L_S_RANGE TYPE RSR_S_RANGESID.

CLEAR: W_I_T_VAR_RANGE_IN, L_S_RANGE.

If I_STEP = 2.

READ TABLE I_T_VAR_RANGE WITH KEY = 'ZSYSDT' INTO W_I_T_RANGE_IN.

CASE VNAM.

WHEN ZSYSDT.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-LOW = SY-DATUM.

APPEND L_S_RANGE TO E_T_RANGE.

ENDCASE.

ENDIF.

3.Now in the new formula subract ZRELDT from ZSYSDT.

This will display the no of days. You can do this at CKF level also.

Former Member
0 Kudos

Hello Sudhakar

You need Two Formula Variables in order to Calculate No of days From your available 'Release Date' and the Current date( which is not available in your cube).

1) Create one Formula Variable(For Ex, ZV_RLDT), with following properties

Processing Type : Replacement Path

Characteristic : Your Release Date attribute

Replace Variable with : Key

Dimension ID : Date

This variable will be populated by your Release date Attribute

2) Create another Formula Variable(Ex,ZV_CURDT), with following properties

Processing Type : Customer Exit

Dimension Id : Date

Insert the following Code in your CMOD project in the Include (ZXRSRU01) section of Function Exit (EXIT_SAPLRRS0_001)

-


DATA: wa_e like line of e_t_range.

CASE I_VNAM.

when 'ZV_CURDT'.

clear wa_e.

wa_e-sign = 'I'.

wa_e-opt = 'EQ'.

wa_e-low = sy-datum.

append wa_e to E_T_RANGE.

ENDCASE.

-


This will populate the Current Date in the Variable 'ZV_CURDT'.

3) Now write the below shown simple logic in your new Formula defined on Keyfigures

No. of Days = ZV_CURDT - ZV_RLDT

Hope this Helps.

Let me know still if any doubts.

Dont forget to assign points if it solves your problem.

Balu P

IBM

Former Member
0 Kudos

Hi Balu,

Thanks for your reply. I am sorry for the late reply. really hat a great explaination.

I will do it and let you know.

Please let me know your email Id and phone number. I am currently in UK.

Thanks,

Suresh

Former Member
0 Kudos

Balu,

Do you have any idea after getting calculated the No. of days, Indeed I have to devide by 30 in order to get months.

So I have to build a quey where I nedd to display the Stock Quantities against to the Titles according to their ageing.

Let us see, the following objects available in the Query:

<b>Stock Quantity</b>(selection in Columns, ristricted with Current cal week)

<b>Age</b>: in Months( should be hidden)

<b>Titles</b>

Now I will place the titles in rows. In the columns I should have <b><6Months</b>, <b><12 Months</b>, <b><24 Months</b>, <b>>24months</b>. All these columns should display the stocks.

How to write formulae for the above columns.

Thanks,

Suresh

Former Member
0 Kudos

Hi,

Once you are done with first coulmn you can go for offsets on the variables to get the other columns.

Also check the below link so that you will get some idea on how to design aging buckets.

Message was edited by: AVR - IGA

Former Member
0 Kudos

Hi AVR,

Infact I have Column called <b>Age</b>, and <b>Stock</b>.

I mean to say In rows Titles are placed and in columns Age and Stock.

Indee I want to hide them Once I calculated the <6 Months, <12 Months etc.... In each of these columns the stock should display.

Thanks,

Former Member
0 Kudos

Hi,

Then you need to have a variable on the period on which you can do offset.

Former Member
0 Kudos

you can define a formula variable for the same. I had done that in my last project. if you need to calculate the diff. b/w 2 date fields. define 2 variables and then one formula variable which is the difference b/w the both.

Steps are as follows.

Under key figure, right click and select New Formula. Under formula variable, right click again and define new variable. The variable wizard will pop up. in that eneter the name and description. Processing by must be Replacement path.

Then click on the NEXT button and select the infoobject. In your case it will be a data characteristic i.2 0DATE. and then click on the NEXT button and select Replacement variable with 'KEY. then go to the next screen and select DIM ID ad number. then clcik on finish.

Now to the above steps for other dtae variable.

Once the variable for bothe the dates are defined now you can use both the variable to calculate the formula i.e you can caluclate the difference b/w both the dates.

hope this will help.

if you still have doubt then please let me know.

contact tapan.tripathy@wipro.com.

Regards,

Former Member
0 Kudos

Hi,

You can do that in a customer exit I believe. Let me know .