ABAP – Function Module for calculating number of days in a Month

In ABAP you can calculate the number of working days for a particular month by using the  function module  NUMBER_OF_DAYS_PER_MONTH_GET.

Usage:

DATA:  l_days type t009b-butag,

l_month TYPE t009b-bumon,
l_year  TYPE t009b-bdatj.
l_month = sy-datum+4(2).
l_year  = sy-datum+0(4).

CALL FUNCTION ‘NUMBER_OF_DAYS_PER_MONTH_GET
EXPORTING
PAR_MONTH       = l_month
PAR_YEAR        = l_year
IMPORTING
PAR_DAYS        = l_days.

write: l_days.

The variable l_days will contains the number of working days for a given month and year.

The output will be the number of days in the current month.

0 Comments

Leave A Reply