on 12-13-2018 2:31 AM - last edited on 02-03-2024 11:38 PM by postmig_api_4
Hi,
We'd like to do some of our reports by Week based on the date of the transactions, I can't find a formula to add a calculated field for the week number. Is there a way to do this?
kind regards,
Jeroen Zijderveld
Hello Jeroen,
If you are looking to compute the week number in the year, you can simply compute the number of days between 1st January and your current date, divide by 7 and add 1. Basically: nr_days_between(1st Jan, your date)/7 + 1.
Please use these date formulas available for CDS Views: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_f1_date_functions.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to join this table scal_tt_date and get 'yearweek' field.
Bye.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've had this issue resolved previously with Jeroen's code. However, now in the new year the CDS view/query I have created returns dates up till 04.01.2021 (monday) as week 1, and from 05.01.2021 (tuesday) as week 2. Any idea's what could be the reason?
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear All,
Final result for week number:
division( DATS_DAYS_BETWEEN(cast( concat( substring( I_TimeSheetRecord.TimeSheetDate, 1, 4 ), '0101' ) as ABAP.DATS ),I_TimeSheetRecord.TimeSheetDate), 7, 0)+1
feel free to use
rgds
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.