Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to calculate number of days from a date field

Dear BW Experts.

I have a field 'Create Date' in the BEx query. Now we need to create a variable which should give the number of days from the date of running the query (sy-datum) to the Create Date.

This will help the users to get records which are say, 30 days old (Sy-datum - create date = 30) or 10 days old etc.

Could you suggest as to how to create this variable.



Former Member
Former Member replied

you have to create 2 formula variables.

FV1 to get sy-datum.

Create FV1 with customer exit as processing type and in CMOD you have to write logic to pass sy-datum value to this formula variable. Pls note - In the last tab of your Formula Variable Screen, do not forget to select date as type for this Formula Variable.

FV2 to get create date.

Create FV2 with Replacement Path as processing type. Select Create date infoobject in the list and under replacement tab, make sure it is getting replaced with key value.

And then create a Formula and use FV1 - FV2. This would get you the total no of days.

--- Thanks...

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question