Working days

data: xt001w type t001w.
data: duration type i.
data: sdate type sy-datum.
data: edate type sy-datum.
 
* Get the factory calendar for specific plant
select single * from t001w into xt001w
                   where werks = '0004'.   " Use your plant
 
* Set start/end dates
sdate = sy-datum.
edate = sy-datum + 30.
 
call function 'DURATION_DETERMINE'
 exporting
   factory_calendar                 = xt001w-fabkl
 importing
   duration                         = duration     " In days
 changing
   start_date                       = sdate
   end_date                         = edate
 exceptions
   factory_calendar_not_found       = 1
   date_out_of_calendar_range       = 2
   date_not_valid                   = 3
   unit_conversion_error            = 4
   si_unit_missing                  = 5
   parameters_not_valid             = 6
   others                           = 7.
 
write:/ duration.

猜你喜欢

转载自www.cnblogs.com/aurora-cj/p/10422128.html