Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM required

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

<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

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

Hi,,

Use the FM " DATE_CONVERT_TO_FACTORYDATE"

Regards,

Nagaraj

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Try FM <b>HOLIDAY_GET</b>.

Regards,

Padmam.

Former Member
0 Kudos

<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

Former Member
0 Kudos

<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