cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to calculate difference between two dates

Former Member
0 Likes
5,462

Hi,

I know there are similar posts related to this; I've gone over them but didn't quite get what I wanted. I need to calculate the difference between two dates ClearingDate and NetDueDate and the result should be a number stored into a Characteristic called OnTime which will be in a Standard DSO and the cube above it. How can I achieve this? I would appreciate a step-by-step solution if possible. I am not proficient in ABAP and hence if there is coding involved, please provide the actual code too. I need it urgently. I will appreciate the help and points will be awarded.

Thanks in advance.

View Entire Topic
Former Member

so you will have to connect to the 2 dates to your info object in your transformation.

define routine on this object and in your routine do this

 

DATA: EDAYS   LIKE VTBBEWE-ATAGE,

           EMONTHS LIKE VTBBEWE-ATAGE,

          EYEARS  LIKE VTBBEWE-ATAGE.

 

PARAMETERS: clearingdate LIKE VTBBEWE-DBERVON,

             netduedate   LIKE VTBBEWE-DBERBIS .

 

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

   exporting

     i_date_from          = clearingdate

     i_date_to            = netduedate

*   I_FLG_SEPARATE       = ' '

   IMPORTING

     E_DAYS               = EDAYS

     E_MONTHS             = EMONTHS

     E_YEARS              = EYEARS.

 

that should give you the number of days your edays will the difference in days.. the fucntion moduel exists in R/3 i am not sure if it exists in Bw system, so you could copy the code from r/3 and create your own function module in Bw and call your..

Former Member
0 Likes

Thanks Amer. Appreciate the quick response. As I said earlier, I'm not too comfortable with writing routines, etc. but the code that you mentioned in your response, is that exactly what I can copy and paste into the field routine? Will my characterstic "OnTime" show the number of days with the code above? We are particularly looking for a positive, negative or a zero value to be populated into OnTime.

What is the name of the function module in ECC?

anshu_lilhori
Active Contributor
0 Likes

Hi,

Just map your two date fields to the infoobject in which you want to get the difference.

And write simple field level routine.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/609eea32-455e-2c10-c08a-c23adf8c9...

Check the page 7 of the above doc.it has the code with screen shot.

No need to use any function module for it.

Regards,

AL

Former Member
0 Likes

Thanks Anshu. I was going through the transformations and noticed that there is a formula called DATE_DIFF (Date Difference: Calculates the difference in days between two specified dates). Why can't we use that? Why does it have to  be a routine? Just curious about it. Please advise.

Thanks!

Former Member
0 Likes

You can use this formula but you need to specify the dates as key figure in your cube/dso.

Cheers!

anshu_lilhori
Active Contributor
0 Likes

Hi,

Yes you can use that formula as well.it should produce the same result what that routine is gonna do.

Former Member
0 Likes

Hey Suyash,

How would I do that (specify as keyfigures in DSO and cube)? I have two dates, 0CLEAR_DATE and 0NETDUEDATE. Simply using the formula won't work? Please advise.

Former Member
0 Likes

yes it should work , 1 way to find out, is to plug and try it :-), there is a check in the bottom of transformation for you to test it out, if u r on 7.0 version of bw

Former Member
0 Likes

Hey Anshu,

I have been asked to get only Open Items managed into the DSO. How can I do that? I have been researching a LOT and I'm confused now. There is an indicatory in BSEG called XOPVW which is called Open Item Management. There were a few suggestions of checking if the GL account masterdata has an attribute to indicate OI management but I don't see it. We don't want to bring it at the transaction level (because thats what XOPVW is). Any suggestions? I'm stuck bad and not sure how to proceed.

The issue is that we are using 0fi_gl_14 and need to leverage that. We have added aging related fields to the extractor and are loading into a write-optimized. I've been looking at BSEG and there is an Open Items Management field (XOPVW) which we are not bringing to the extractor (yet). Any idea what I could do from this point onwards?

If there is another route you can suggest, then please do in a step-by-step manner. It's urgent. I appreciate the help. The end goal is to create Aging reports for Customer and Vendor. HELP.

anshu_lilhori
Active Contributor
0 Likes

Hi,

It would be better if you open up a new thread with proper subject line.As this thread  is already closed and had a different content.

More people may give inputs if you do as stated above.

Regards,

AL