Application Development and Automation 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: 
Read only

FM required

Former Member
0 Likes
848

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
Read only

Former Member
0 Likes
802

<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

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

5 REPLIES 5
Read only

former_member404244
Active Contributor
0 Likes
802

Hi,,

Use the FM " DATE_CONVERT_TO_FACTORYDATE"

Regards,

Nagaraj

Read only

Former Member
0 Likes
802

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

Read only

Former Member
0 Likes
802

Hi,

Try FM <b>HOLIDAY_GET</b>.

Regards,

Padmam.

Read only

Former Member
0 Likes
802

<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

Read only

Former Member
0 Likes
803

<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