How get work day ABAP?

Get work date in SAP with ABAP important task for SAP developers and I will show example getting factory day in SAP system. If we want to get next work day for sending email, or previous work day for checking activities or work date for planning.

Work date in ABAP

For example, I choose first standard calendar ID from SAP table TFACD. In real work often using custom tables for storage calendars.

Create string with using inline declaration ABAP in new ABAP syntax and variable for calendar also.

After preparing data we execute function module DATE_CONVERT_TO_FACTORYDATE for getting first work day since date lv_str. It can be the same date if in lv_str work day or next work day if not.

Function module DATE_CONVERT_TO_FACTORYDATE have more parameters then I use in my example. All parameters for this FM:

Function module DATE_CONVERT_TO_FACTORYDATE
Function module DATE_CONVERT_TO_FACTORYDATE

With parameter CORRECT_OPTION where default value ‘+’ we can choose what we want to get: next work day or previous work day (for this you need to use ‘-‘ ).

Example using DATE_CONVERT_TO_FACTORYDATE

Full ABAP code with example. How to get work day or factory day in SAP:

Leave a Reply