07-03-2007 9:25 AM
Dear Experts,
I need to convert working days into calendar days using calendar key.
The table is TVRO. calendar key TVRO-SPFBK.
Pls provide some FM to convert this. and also provide example to do this
Thanks in advance
karthik
07-03-2007 9:42 AM
<b>Function to return next business day</b>
<b>A function that will return next business day, based on the country. </b>
This function will allow users to specify e.g. 10 business days from now.
<b>Here is the code. </b>
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 <b>DAY_ATTRIBUTES_GET</b>.
You need to provide the calendar and a time interval, and the fm returns an internal table showing days with flags holiday / working day.
reward points if it sis usefull ....
Girish
07-03-2007 9:28 AM
07-03-2007 9:32 AM
Try using as below
'DATE_CONVERT_TO_FACTORYDATE'
call function 'DATE_CONVERT_TO_FACTORYDATE'
exporting
correct_option = '-' " Adjustment
date = d1 " Date In
factory_calendar_id = 'P6' " Calendar Id
importing
date = xdate. " Date out
07-03-2007 9:32 AM
07-03-2007 9:40 AM
<b>Q :</b>How to find out the number of days between a given date, excluding Saturdays and Sundays and public holidays?
<b>A: </b>=> <b>DATE_CONVERT_TO_FACTORYDATE</b>
=> <b>HR_HK_DIFF_BT_2_DATES</b>
reward points if it is usefull ...
Girish
07-03-2007 9:42 AM
<b>Function to return next business day</b>
<b>A function that will return next business day, based on the country. </b>
This function will allow users to specify e.g. 10 business days from now.
<b>Here is the code. </b>
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 <b>DAY_ATTRIBUTES_GET</b>.
You need to provide the calendar and a time interval, and the fm returns an internal table showing days with flags holiday / working day.
reward points if it sis usefull ....
Girish