Manipulate dates in ABAP

Manipulate dates in ABAP

Check dedicated post to Add days/month/year to date.

Manipulate dates in worked days (or factory days)

Add working days to a date

You can use Function BKK_ADD_WORKINGDAY.

Difference between 2 dates in worked days

You can use Function RKE_SELECT_FACTDAYS_FOR_PERIOD.


  DATA : lt_dates_in_period TYPE STANDARD TABLE OF rke_dat,
         lv_calendar_fr     TYPE wfcid VALUE 'FR'.

  CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
    EXPORTING
      i_datab               = lv_date_1 " // 2023-09-01 (Friday)
      i_datbi               = lv_date_2 " // 2023-09-05 (Wednesday)
      i_factid              = lv_calendar_fr 
    TABLES
      eth_dats              = lt_dates_in_period " // [3x1(16)] Standard Table
    EXCEPTIONS
      date_conversion_error = 1
      OTHERS                = 2.

  IF sy-subrc = 0.
    " lt_dates_in_period contains list of worked days dates :
    " [ [ 2023-09-01 ]
    "   [ 2023-09-04 ]
    "   [ 2023-09-05 ] ]

    DATA(lv_num_worked_days_in_period) = lines( lt_dates_in_period ). " // 3
  ENDIF.

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

Leave a Reply