Register Login

Function Module To Find The Start Date Of Current Week.

Updated May 18, 2018

Data:
   l_scal_week LIKE scal-week,
   l_date_low like sy-datum,
   l_date_high like sy-datum.

*--- Find start date for current week

* Find current week
CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
      date         = sy-datum
    IMPORTING
      week         = l_scal_week
    EXCEPTIONS
      date_invalid = 1
      OTHERS       = 2.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.

* Start date current week
  CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
      week         = l_scal_week
    IMPORTING
      date         = l_date_low
    EXCEPTIONS
      week_invalid = 1
      OTHERS       = 2.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.


Comments

  • 20 Dec 2016 1:33 pm Guest
    WEEK_GET_FIRST_DAY working wrong on the exxample: giving on input the 201501 week and on output it giving me date like 20141229. Why?

×