cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Cal Month and Year based on Print date in SAP BI Routine

Former Member
0 Kudos

Hi Expert,

We've to derive Cal month and year based on the print date in transformation routine. Could you please share sample code how to derive this? Do need to do in start/field routine or end routine.

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member197660
Contributor
0 Kudos

Hi Pawan

As Ganesh mentioned you don't need to write a routine for this derivation.

Just map the date you receive in source field to the Calmonth/CalYear field in Transformations, SAP will automatically derive the values based on source data.

Although an alternative could be to use the SAP's standard functions available like CalYear, Calmonth which takes a date field as input to derive the respective outputs.

You can use this as formula in transformations.

Thanks & Regards

Ashish

Former Member
0 Kudos

Hi

Please can you give example how to use this .. say e.g. I'm deriving month and year based on ZPRINTDT.. then how to use these formula.

I'm not deriving using system data. Will it still work.

former_member183012
Active Contributor
0 Kudos

Hi Pawan,

Can you just map your date field to all three info objects 1)calday 2)calmonth 3)calyear.

please do that in development system and check that data what it is populating. It will populate correct data please check and let us know if any issue.

Regards,

Ganesh Bothe

karthik_vasudevan
Active Contributor
0 Kudos

Hi Pawan

You could just map the print date to month and year using time characteristic rule type.

If you have a special fiscal year variant for your company, please select formula as rule type and map print date to month and use the below formula

Regards

Karthik

former_member197660
Contributor
0 Kudos

Hello Pawan

As mentioned in the image mentioned by Karthik, you can use the update type of characteristic as formula and use the SAP standard functions like :DATE_MONTH() , DATE_TO_WEEK () etc.

However the easiest seems to be direct assignment just assign print date to the target fields SAP will internally derive Calweek and Calmonth assuming the value of your char: ZPRINTDT is identical as of Sy-datum.

Note: If the format of value in ZPRINTDT is different then you might need to go for formula or routine.

Regards

Ashish

former_member183012
Active Contributor
0 Kudos

Hi Pawan,

I think without routine also you can populate calmonth and cal year using date(Time conversion)

Regards,

Ganesh Bothe