cancel
Showing results for 
Search instead for 
Did you mean: 

Replicating Factory Calender Function Module in HANA

Former Member
0 Kudos

So the challenge I have will sound easy but I've been struggling to figure out how to solve it.

On ECC there is a function module 'DATE_CONVERT_TO_FACTORYDATE', this function module is used to figure out valid working days. If you input the date in the module it will export whether it's a holiday or not, and basically calculate based on that. It seems a holiday can be entered manually and this functional module captures it. Also, factory calender can be viewed using tcode SCAL on HANA side.

I need to calculate dates by replicating the function module.

Anyone know which tables store factory dates which I can create views off of? And I'm assuming I have to do some SQL coding in calculation view (maybe a loop).

If anyone has any insight on how to do this in HANA it will be very helpful.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mic,

The time dimension tables are all under the schema _SYS_BI (e.g. M_FISCAL_CALENDAR, M_TIME_DIMENSION etc). I had suggest you have a quick look at these tables and its contents to see if that is  sufficient for your requirement. If not, yes you probably will have to create it as a procedure to replicate the functionality of the function module.

Thanks,

Anooj

Answers (3)

Answers (3)

dmitry_kuznetsov1
Active Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

Thanks Anooj and Bikas. I understand both posts.

Here is what I found, need some insight on approach. I've finally figured out which table stores the Factory Calendar dates in ECC, it’s TFACS.

The bad news is that the dates are stored in binary form (Ex. 010101000010100101). The 0 indicated non-working day while 1 is working day.

So it seems (if possible) to create an Attribute View OR some sort of SQl code in Calculation View to figure out how many working days exist. Any advice?

Below is a screenshot of the output:

Former Member
0 Kudos

Hi Mic,

Quite interesting. I would go with 2 approaches -

1. Because factory calendar is quite static and doesnt change quite frequently, I would create an ABAP in ECC and store a data in readable format in a ZTABLE. You can run the ABAP based on calendar change events. SLT the table and use it in the Time Dimension AT view.

2. Create a procedure to decode the table. or create a SQL calc view.You can call the Procedure in SQL Calc Views or use the SQL calc view in other Graphical Calc views.

I would go for option 1.

On a different note, ask the smart functional consultants to find a better table. Just in case.

/bikas

Former Member
0 Kudos

Bikas, we are trying to avoid creating anything custom on ECC side, trying to see if anything can be done on HANA side.

Your option 2 seems like what I will try to get involved in, even though my familiarity with SQL/Procedure is weak.

So I basically I have to find the number of days between 2 dates (Start_date and End_date). I'm still not sure how I should code this, I do have ABAP background, so I'm sure it's possible.

It seems I have to keep looping between the start_date and end_date to figure out how many 1's and 0's I have, and then add the 1's. But from a technical perspective, identifying the binary code using date is the challenge.

Any advice will be helpful.

former_member184768
Active Contributor
0 Kudos

Hi Mic,

I know this is late by almost an year, but hope this helps.

http://scn.sap.com/docs/DOC-44483

As they say, better late than never.

Regards,

Ravi

Former Member
0 Kudos

Hi Ravi,

I have a similar query on Function Modules. Is it possible to accelerate function modules on HANA using Application acceleartor.

Thanks in advance for your help.

Regards

Preeti

Former Member
0 Kudos

Hi Mic,

You can create a Time Dimension attribute view by joining M_TIME_DIMENSION from _SYS_BI and THOC/THOL tables from your ECC system.

This will give you single view of all the dates(both SAP and SQL) and the corresponding public/factory holidays.

You can always create a Stored procedure but it restricts the usability like you can use the procedure in a SQL based Calc view.

/bikas