Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Week - ABAP

f_allocca
Participant
0 Kudos

Hi Experts,

Previously I asked for a way to derive Year and Week number respecting the following specifications:

  1. The first week of the year is the one that starts on Sunday
  2. The first day of the week is Sunday

Here is an example screen:

I was advised to use the following method and it works: (Number of week in 'v_week' variable)

Now I need a way to calculate the data (YYYYMMDD) starting from Year and Week (YYYYWW) respecting the same specifications above

Thanks

Francesco

1 ACCEPTED SOLUTION

swapan_sarkar1
Participant
0 Kudos

You may just want to create a custom table with Year, Week & date of first & last date of the week for next 100 years (you may write a script for that). There will be about 5200 - 5300 records in it. This will help with performance if you are using CDS views and want to use it in a JOIN.

5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos

If you know which day of the week is January 1st, as a number between 1 and 7 (not sure in your case which number is Sunday), then you can determine how many days are to be added to reach Sunday. Can't you? Is there any problem.

f_allocca
Participant
0 Kudos

from 2021.02 (YYYY.WW) Wednesday I need to calculate what date corresponds, for example 13.01.2021 (DD.MM.YYYY)

How can I do it?

FredericGirod
Active Contributor

number of week * 7

I win the price ??

swapan_sarkar1
Participant
0 Kudos

You may just want to create a custom table with Year, Week & date of first & last date of the week for next 100 years (you may write a script for that). There will be about 5200 - 5300 records in it. This will help with performance if you are using CDS views and want to use it in a JOIN.

Sandra_Rossi
Active Contributor
0 Kudos

So you know that first week in the year (2021.01) starts on 06.01.2021.

Week 2021.02 starts on 13.01.2021.

Week 2021.03 starts on 20.01.2021.

I think that frdric.girod won the price!