First and last day week in SAP ABAP

How to get first and last date week ABAP? This question we will resolve in this article with using function modules for work with dates in SAP.

Get week number ABAP in SAP

How to get week number in SAP ABAP? For task getting week number SAP you can use function module DATE_GET_WEEK. If you need to plan some weekly activities or check some result by week it can be useful for you. Simple example using function module DATE_GET_WEEK in SAP program:

Function module don’t have a lot of parameters, but add for understanding types and exceptions:

Function module DATE_GET_WEEK

First week day ABAP in SAP

How to get first week day in SAP ABAP? Task getting first week day SAP you can resolve with function module WEEK_GET_FIRST_DAY. But more often this FM use with DATE_GET_WEEK for getting week. Example how to get week you can see above. Simple example how get first day week SAP:

Function module WEEK_GET_FIRST_DAY don’t have a lot of parameters, but put this for understanding types and exceptions:

Function module WEEK_GET_FIRST_DAY

How get first and last days week in ABAP program?

Code template:

In this case, for example for LV_DATE = ‘20241018’ after FM DATE_GET_WEEK variable LV_WEEK = ‘202442’.

After function module WEEK_GET_FIRST_DAY LV_START = ‘20241014’.

When we add 6 days to LV_START = ‘20241014’ it will be LV_END = ‘20241020’ .

Leave a Reply