cancel
Showing results for 
Search instead for 
Did you mean: 

How to derive time in months from year and month fields in a transformation?

former_member649905
Participant
0 Kudos

Hi There,

I am on BW 7.3 and I some help in writing a routine that would calculate/derive the total time in months (target DSO) from a date field (format YYYYMM e.g 2008.01) (source DSO), the derivation should be based of course of the sy-datum.

Any inputs in writing this routine in my transformation?

Thanks,

Blaiso

Accepted Solutions (1)

Accepted Solutions (1)

former_member649905
Participant
0 Kudos

Resolved!!! I did not used a FM, I just defined 2 variables to hold source date and target date and I perform a simple calculation giving the difference between target date and source date.

Thanks,

Blaise

Answers (3)

Answers (3)

former_member188080
Active Contributor
0 Kudos

check following thread of any help

http://scn.sap.com/thread/1974114

http://scn.sap.com/thread/2126460

Thanks and regards

Kiran

former_member182343
Active Contributor
0 Kudos

Hi,

Better use Function Module - FIMA_DAYS_AND_MONTHS_AND_YEARS.

Input parameters - Date

Export Paramerts - Variable.

Pass this  variable to RESULT.

Regards,

rvc

former_member182470
Active Contributor
0 Kudos

HI

What is your required format in target DSO? Do you just need a count of months?

Regards,

Suman

former_member649905
Participant
0 Kudos

Hi Suman,

That is correct, In the target DSO, the Z_time field is type "num" and should be holding a total count/Sum in months derived from year and month from Z_date field in source DSO.

Example: Z_date = 01.03.2011

Based on sy-datum,

Z_time = count in months [(2011 to 2012 = 12 months) and (03 to 07 = 04 months)] = 16 months

Any input in writing the corresponding routine pl?

Thanks,

Blaiso

Former Member
0 Kudos

Hi ,

have a look on the below thread .

http://scn.sap.com/thread/709693

hope it may be helpful.

You can include function module 'FIMA_DAYS_AND_MONTHS_AND_YEARS' or "HR_MONTHS_BETWEEN_TWO_DATES" in your program to get the count of months.

Regards,

Ramitha