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: 

I want to find the No.of working days between the two dates

Former Member
0 Kudos

Hi experts ,

Is there any function module to calculate No of working days between two days.

Please help

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Ramesh,

check this fm : FIMA_DAYS_BETWEEN_TWO_DATES

Thanks

Kam

9 REPLIES 9

former_member181962
Active Contributor
0 Kudos

Try one of these,

WEEK_GET_NR_OF_WORKDAYS

WLB3_GET_NUMBER_OF_WORKDAYS

Former Member
0 Kudos

Ramesh,

check this fm : FIMA_DAYS_BETWEEN_TWO_DATES

Thanks

Kam

0 Kudos

Try this...




report zrich_0001.

parameters: p_start type sy-datum,
            p_end   type sy-datum.



data: idays type table of   rke_dat with header line.

data: workingdays type i.

call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
     exporting
          i_datab               = p_start
          i_datbi               = p_end
          i_factid              = 'P8'  " Fact Calender ID
     tables
          eth_dats              = idays
     exceptions
          date_conversion_error = 1
          others                = 2.


describe table idays lines workingdays.

write:/ workingdays.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi experts,

i am using one date function module that is accepting only one date format that is yyyymmdd.

why it is behaving like this.

is there any function module to convert date to yyyymmdd

from diff date formates.

Pleas help

0 Kudos

you can use the syntax

WRITE DATE TO new_date <date format>.

0 Kudos

You can convert your data via the following function modules.




call function 'CONVERT_DATE_TO_EXTERNAL'
* EXPORTING
*   DATE_INTERNAL                  = SY-DATUM
* IMPORTING
*   DATE_EXTERNAL                  =
* EXCEPTIONS
*   DATE_INTERNAL_IS_INVALID       = 1
*   OTHERS                         = 2
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.


call function 'CONVERT_DATE_TO_INTERNAL'
  exporting
    date_external                  =
* IMPORTING
*   DATE_INTERNAL                  =
* EXCEPTIONS
*   DATE_EXTERNAL_IS_INVALID       = 1
*   OTHERS                         = 2
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Regards,

Rich Heilman

0 Kudos

Ramesh

Use <b>FM CONVERT_DATE_TO_INTERNAL</b> convert date to <b>yyyymmdd</b>.

Thanks

Kam

former_member181962
Active Contributor
0 Kudos

HI Ramesh,

YOu can use the FM DATE_CHECK_WORKINGDAY for checking whether it is a woking day or not.

you can loop a internal table with all the range of dates and check in this Function module as well.

Former Member
0 Kudos

whatever date u use internally it is converted to yyyymmdd.

Use the code.

v_date1 like sy-datum,

v_date2 like sy-datum.

v_date1 = date1.

v_date2 = date2.

then pass on this values to the function module and u will get the desired output.