Hi,
Yes..
What do you really want to achieve?
May I know the purpose why you need the routine you have posted in transformation level? If you only wanted to divide your data by bulk, then we can do it in BEx level by separating your CALDAY values by 1-7, 8-14, etc..
Regards,
Loed