Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > SAP Forum > SAP ABAP HR Forum


Function to return next business day


Reply
Views: 1408  
Thread Tools Rate Thread
  #1  
Old 05-22-2009, 05:43 AM
bholus7
Guest
 
Posts: n/a
Default Function to return next business day

Function to return next business day



A function that will return next business day, based on the country.
This function will allow users to specify e.g. 10 business days from now.
Here is the code.



Code:
REPORT ZRM_TEST .
PARAMETERS: DATE_1 LIKE SY-DATUM DEFAULT SY-DATUM,
BIZ_DAYS TYPE I DEFAULT 2,
FACCALID LIKE SCAL-FCALID DEFAULT 'US'.
DATA: FAC_DATE_1 LIKE SCAL-FACDATE,
DATE_2 LIKE SY-DATUM,
FAC_DATE_2 LIKE SCAL-FACDATE.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = DATE_1
FACTORY_CALENDAR_ID = FACCALID
IMPORTING
FACTORYDATE = FAC_DATE_1 .
FAC_DATE_2 = ABS( FAC_DATE_1 + BIZ_DAYS ).
CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'
EXPORTING
factorydate = FAC_DATE_2
factory_calendar_id = FACCALID
IMPORTING
DATE = DATE_2
.
WRITE: / DATE_2.

You can also try the function module DAY_ATTRIBUTES_GET.
You need to provide the calendar and a time interval, and the fm returns an internal table showing days with flags holiday / working day.



Reply With Quote
Reply

New topics in SAP ABAP HR Forum





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)