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: 

How to get working Date based on factory Calendar and current date

Former Member
0 Kudos

Hi All,

I want to deletermine a date which is Invoice date + 3 working days excluding SAT, SUN and holidays. For e.g, if Invoice date is 18th Sept, 2009, then my desired date should 23rd Sept, 2009.

I do have factory calendar ID but i dont know the proper function module.

Can some one please help me...

3 REPLIES 3

Former Member
0 Kudos

Did you try FM:


BKK_ADD_WORKINGDAY

former_member705122
Active Contributor
0 Kudos

Hi,

check this code,

DATA:
w_date   TYPE dats,
w_date1  LIKE scal-date,               " dats
w_date2  LIKE scal-date,
i_factid LIKE tkevs-fcalid VALUE 'IN', " IN for India
it_dats  TYPE TABLE OF rke_dat,
wa_dats  LIKE LINE OF it_dats,
w_lines  TYPE i.
 
CALL FUNCTION 'CALCULATE_DATE'
  EXPORTING
    days        = '0'
    months      = '1'
    start_date  = sy-datum             " for example '20090918'
  IMPORTING
    result_date = w_date.              " 1 month added '20091018'

                             
w_date1 = sy-datum.
w_date2 = w_date.
 
CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
  EXPORTING
    i_datab  = w_date1
    i_datbi  = w_date2
    i_factid = i_factid
  TABLES
    eth_dats = it_dats.                " number of working days between two dates
 
READ TABLE it_dats INDEX 4 INTO wa_dats.
WRITE :
  / wa_dats-periodat.                  " new date '20090923'

Hope this will be helpfull...

Regards

Adil

Former Member
0 Kudos

Thanks Aparna.. Its done..