Select working days from interval selection

Hi
I have a requirement to create a report that shows Backorder Value Status for each working day. In our cube we mapped 0CALDAY to sy-datum which keeps the Backorder Data for each load. Data would look like this:
Cal Day   BO$
01/01/08 $200
01/02/08 $500
01/03/08 $100
The report should show the BO value for each day (not a problem) and calculate an average (not a problem either).
The problem is that customer would like to select the range of calendar days (let's say 01/01/08 - 01/03/08) and would like the report to eliminate all non-working days and bring back only BO value for working days:
Cal Day  BO$
01/02/08 $500
01/03/08 $100
I've tried to create Exit Variable -but I read that if variable has selected "ready to input" box in the variable option (which allows the customer to select the range) - it will not look at the code. In the Debbuger the code worked fine - but the report still pulled all calendar days.
Anyone have any other idea how to handle this?
Thank you
Justyna

Hi Justyna,
I'll just hint you some simple processes, which you can try other than exits.
1)If you are reporting only for a particular month data in the reporting use User entry/Default value variable with multiple values entry and select only working days of that month.
2) If you want to use the report year wise then just restrict the 0CALDAY and exclude all the non working days (holidays) for one year.So that Holidays are restricted from the report.
3) Last thing is in the process chain itself while defining the variant select the factory calender and exclude all the holidays.
Assign some points if this is useful.
Warm Regards,
I.R.K.

Similar Messages

  • Function module for getting teh last working day of a month.

    Hi GURUS,
    this is criteria,please help me 
    if V_T001B- FRYE1 < month entered in selection screen
              Then throw the error message
                Else
    Find the previous period and its last working day from the function module
          (i..e Assume entered date as June 2 2009 then
                   Period 6 -1 = 5.
         Pass the month 05 to function module then
                   Find last working day.
                   Keep it in a variable (V_LAST_PRD_WRKDAY)
                           Proceed further.
    thanks in advance,
    Rajeev

    Hi Rajeev,
    You can use Function Module LAST_DAY_IN_PERIOD_GET.
    Ex:
          CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
            EXPORTING
              i_gjahr = p_gjahr
              i_periv = lwa_t009b-periv
              i_poper = lwa_t009b-poper
            IMPORTING
              e_date  = s_audat-high.
    Regards,
    Ravi K

  • Schedule background job for working days

    Hi,
    I would like to schedule a background job, but only runs on working days (from Monday to Friday), I am wondering whether it is possible to run as mentioned or not?
    Kindly advise!
    Thanks!!
    br,
    hy

    hi
        F9 - > click date/time, after the at operation mode tab, there is an arrow mark, click it, in taht mention your factory calendar id (which includes public holidays and specify from which workday it should start, time), then check and come back to the main screen, check periodic job, click the periodic values tab, in that specify it as daily...will solve your requirement
    if helpful, reward
    Sathish. R

  • How to calculate number of working days

    Hi experts,
    I need to determine the number of working days from two given dates. Below is my example.
    1. Posting Date
    2. Clearing Date
    3. Processing Time in Days
    The formula is:
    Processing Time in Days = Posting Date - Clearing Date
    However, the above result should exclude non-working days such as Public Holidays, Saturdays and Sundays.
    This is to be done in my Transfer Rule.
    Can someone help me with this.
    Points will be assigned as usual.
    Thanks!

    Hi,
    With referece to  Florin Wach Reply in the following link:
    Re: FM to get number of working days in a date range for a calender
    Use the update rule(routine) for <i>Processing Time in Days</i> as below:
      DATA: date_begin         TYPE sy-datum,
             date_end           TYPE sy-datum,
             current_date       TYPE sy-datum,
             working_indicator  TYPE SCAL-INDICATOR,
             workdays           TYPE I,
             factory_calendar   TYPE SCAL-FCALID.
       date_begin       = DATA_PACKAGE-PSTNG_DATE.
       date_end         = DATA_PACKAGE-CLEAR_DATE.
       factory_calendar = '01'.
       current_date = date_begin.
       DO.
          IF current_date > date_end.
             EXIT.
          ENDIF.
         CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
              EXPORTING  DATE                 = current_date
                         FACTORY_CALENDAR_ID  = factory_calendar
              IMPORTING
                         WORKINGDAY_INDICATOR = working_indicator
              EXCEPTIONS
                   CALENDAR_BUFFER_NOT_LOADABLE = 1
                   CORRECT_OPTION_INVALID       = 2
                   DATE_AFTER_RANGE             = 3
                   DATE_BEFORE_RANGE            = 4
                   DATE_INVALID                 = 5
                   FACTORY_CALENDAR_NOT_FOUND   = 6
                   OTHERS                       = 7.
         IF SY-SUBRC <> 0.
            workdays = 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            EXIT.
         ENDIF.
         IF working_indicator IS INITIAL.
            ADD 1 TO workdays.
         ENDIF.
         ADD 1 TO current_date.
      ENDDO.   
    Result  = workdays.
    With rgds,
    Anil Kumar Sharma .P

  • Time Dimension Working Days

    Hi i have a calendar table
    Has Year , Month, Week, Date and a flag for a working day or not..
    Is there anyway i can use this working day flag in my Time Dimension Hierarchy so that under Date i can have another drill Working Days ...
    (Non working day is where flag = 'Y')
    Year - Month - Week - Day - Working Day
    or Even
    Year - Month - Week - Working Day
    Cheers
    Bibi

    Year - Month - Week - Working Day
    You could acheive this by putting a filter on your logical table source to exclude non-working days. Or maybe just remove the non working days from the source table
    The trouble with trying to put an extra level in beneath Day is that your primary key, I.e. your lowest level for the date dimension in this case is Day. Working Days won't roll up into Days as they are at the same level.

  • How working days is  treated and counted as leave day.

    Q. What is working Days & How working days is  treated and counted as leave day.
    Case 1-suppose Absence is registered on 15.11.2010- 18.112010.but on 17.11.2010 is a public holiday.in as IT2001 it is showing as Absence hrs =24 days,Abs days = 3 days and Cal days = 4 days .Quota used= 4.
    why it is not showing 32 hrs .
    Thanks

    The counting rule for absences takes care if the public holiday or non working days as to be counted when absence is entered or not.
    If you tick on (not  a public holiday) then only days which are not public holidays wll be counted in absence counting. If you dont check saturday sunday in the rule then sat sunday will be counted towards leave...Other options are also there for eg. Holiday classes. You can make appropriate settings  and include or exclude the working/non working days from absence counting.

  • Dynamic selective deletion of last working day in cube

    Hi experts
    I have studied this document:
    http://scn.sap.com/community/data-warehousing/netweaver-bw/blog/2013/08/06/selective-deletion-in-process-chain
    We need to delete each month at the 6th working day all records of the last working day of the previous month.
    Thereafter we will have to reload the last working day of the previous month again.
    This means there are 2 steps to do:
    1. step:
    create program as described in the link above; this z-program will be used in process chain variant.
    2. step:
    ABAP variable in infopackage which will reload the last working day of previous month.
    Do you have the correct coding samples for both steps available?
    Thanks.

    Hi Thomas,
    I just realized that you should use LT_THX_SEL instead of L_THX_SEL. I corrected your code as:
    REPORT GP00733D41Q8YF4PERY61Y1HNAP .
    TYPE-POOLS: RSDRD, RSDQ, RSSG.
    DATA:
      L_UID       TYPE RSSG_UNI_IDC25,
      L_T_MSG     TYPE RS_T_MSG,
      L_THX_SEL   TYPE RSDRD_THX_SEL.
      L_UID = '00733D41Q8YF4PERYNZWX2EY9'.
      IMPORT I_THX_SEL TO L_THX_SEL
        FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
    *  DELETE FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
      data: wa_tab type RSDRD_S_RANGE.
    data: lt_tab type RSDRD_T_RANGE.
    wa_tab-sign = 'I'.
    wa_tab-option = 'EQ'.
    wa_tab-keyfl = 'X'.
    wa_tab-low = '20140101'.
    append wa_tab to lt_tab.
    clear l_thx_sel.
    LT_THX_SEL-IOBJNM = '0CALDAY'.
    LT_THX_SEL-TRANGE[] = LT_TAB[].
    INSERT LT_THX_SEL into table L_THX_SEL.
      CALL FUNCTION 'RSDRD_SEL_DELETION'
           EXPORTING
                I_DATATARGET      = 'ZCFM_C11'
                I_THX_SEL         = L_THX_SEL
                I_AUTHORITY_CHECK = 'X'
                I_THRESHOLD            = '1.0000E-01'
                I_MODE                 = 'C'
                I_NO_LOGGING           = ''
                I_PARALLEL_DEGREE      = 0
                I_NO_COMMIT            = ''
                I_WORK_ON_PARTITIONS   = ''
                I_REBUILD_BIA           = ''
                I_WRITE_APPLICATION_LOG   = 'X'
           CHANGING
                C_T_MSG                     = L_T_MSG.
      export l_t_msg to memory id sy-repid.
      UPDATE RSDRBATCHREP
        SET  DELETEABLE = 'X'
    I hope that will be the final solution Thomas.
    Regards
    Yasemin...

  • How to select a single day from month view

    From my ipad on IOS7 I can not select a single day from the month view? From the old versions all I had to do was double click a single date even if it had multiple appointments in it to view it. Was this feature removed?  Please help

    It appears to me as though it has indeed been removed. You can tap and hold down on a day while in month view to create or view an event, but you cannot tap on the day to open the whole day's events.

  • Mirrowing option does not appear in my AirPlay after I select Apple tv, it works fine from my phone, any ideas?

    Mirrowing option does not appear in my iPad'sAirPlay after I select Apple tv, it works fine from my phone, any ideas?

    Resolve issues with AirPlay and AirPlay Mirroring from iPhone, iPad, and iPod touch - Apple Support

  • Tolerance dialogue missing on "make work path from selection"

    I am trying to convert a 1-color drawing to a path so I can put it into Illustrator. I use the magic wand to select the edges and get a nice tight fit. But when I select the "Make work path from selection" button, I get a sloppy fit. I've looked this up, and supposedly I should get a dialogue box asking me to state the tolerance. I have never seen that box - I've tried it and had colleagues come try it. My version 13.1.2 x64. Seems like a bug to me, but maybe I'm missing something. Is there another way to do this? Thank.s

    R_Kelly wrote:
    If you press the Alt/Option key while pressing the Make work path from selection button, then you'll get the Tolerance dialog.
    Other ways are to right click inside the selection and choose Make Work Path or use the flyout menu from the Paths panel and choose Make Work Path.
    Hah!  I didn't know that RK
    [EDIT]  As an aside to the above information, having had a play with it, I have realised how poorly the 'Make work path from selection' feature works in Photoshop.  It has always worried me that distibution of points that result from using that feature on a Shift drag eliptical marquee circle, appear less than optimal, but I have just lived with that because it is quick and convenient.  But having just looked again, zooming right in and activating the point handles, the curve is just plain horrible!
    Me thinks I shall take the time to do it properly in future, by using the Shape tool.
    It also amazed me how many points were used when setting tolerance to the minimum of .5
    Anyway...  I am not getting my work done here, so time to earn a living

  • Holiday as Working day - Marked as leave is not deducting from Quota

    Hi Experts,
    Please help me with below mentioned scenario.
    We have one holiday calendar for two personnel areas however holidays are different in both personnel areas, and as it is middle of year so I can't create a new holiday calendar for other personnel area so we maintain special day as working day in factory calendar to change holiday as working day for one personnel area.
    Holiday Calendar :- HA (haryana) ,                      Personnel Area (A)           Personnel Area (B)
    Holidays :-     25th Till 28th Oct Diwalii,                25th till 28 Holiday             26 & 27 Holiday only (25 & 28 working in special day rule)
    Issue :- personnel area (B) Now if Employee is getting leave for 25th (which is holiday in calendar and maintained as working day in special day rule) it is not deducting leave from quotas.
    Issue :- Half Employee on 25th are marked as Holiday (HH) in system however half have Absent (AA) in report.
    **(Should I try to make a deduction rule and counting rule for 25th & 28th as it is holiday & working togather... if yes thn what needs to be selected in counting rule)**
    Please provide inputs in this regards as it is urgent.
    Thanks you!!
    Anshul

    Hi Swapnil,
    Thanks man, I understood now, Yes you are right as but it is not working when I am trying to solve this issue after maintaining IT 2003. Now I have to go with second solution however I made Counting rule and deduction rule but facing issue assigning counting rule to Absence Type so the question is Do i need to make new absence type then counting rule and deduction rule or I can just make a counting rule and assign it to the existing Absence type?????
    Please help me through the process as I am little confused, just explain a bit like.. I need to make counting rule and assign it from <so & so> place.
    Thank you so much for your precious time,
    Anshul Upadhyay

  • I didn't receive my return box from Apple for the iPod Nano replacement as promised within 2 working days, did anyone else?

    I didn't receive my return box from Apple for the iPod Nano replacement as promised within 2 working days, did anyone else?

    UPDATE. Just spoke with an AppleCare representative, Apple has been inundated with requests for these iPod Nano replacements.  They have fallen behind with sending out the return boxes in the 2 days they promised.  I was told to wait an additional 2 days.  She also said they were very surprised so many people still have their 1st generation nanos...
    We have been an Apple family for years and trust they will do the right thing, they have always surprised us with their professional customer service and expect this situation to be the same.

  • To find the no of working days b/w given date

    Hi ABAP Experts,
             Here i have one requirement .
             table is tfacs
              in  this table i want to know the no of working days b/w  the given date. Here i have attached my code .pls go through it and do me needful.
    TABLES : tfacs,vbrk.
    DATA: BEGIN OF ty_tfacs OCCURS 0,
            ident TYPE tfacs-ident,
            jahr TYPE tfacs-jahr,
            mon01 TYPE tfacs-mon01,
            mon02 TYPE tfacs-mon02,
            mon03 TYPE tfacs-mon03,
            mon04 TYPE tfacs-mon04,
            mon05 TYPE tfacs-mon05,
            mon06 TYPE tfacs-mon06,
            mon07 TYPE tfacs-mon07,
            mon08 TYPE tfacs-mon08,
            mon09 TYPE tfacs-mon09,
            mon10 TYPE tfacs-mon10,
            mon11 TYPE tfacs-mon11,
            mon12 TYPE tfacs-mon12,
            basis TYPE tfacs-basis,
            fenum TYPE tfacs-fenum,
            wenum TYPE tfacs-wenum,
            load TYPE  tfacs-load,
            string1(31) TYPE c,
            string2(31) TYPE c,
            string3(31) TYPE c,
            string4(31) TYPE c,
            string5(31) TYPE c,
            string6(31) TYPE c,
            string7(31) TYPE c,
            string8(31) TYPE c,
            string9(31) TYPE c,
            string10(31) TYPE c,
            string11(31) TYPE c,
            string12(31) TYPE c,
            uk(31) TYPE c,
            total1 TYPE i,
            total2 TYPE i,
            total3 TYPE i,
            total4 TYPE i,
            total5 TYPE i,
            total6 TYPE i,
            total7 TYPE i,
            total8 TYPE i,
            total9 TYPE i,
            total10 TYPE i,
            total11 TYPE i,
            total12 TYPE i,
            END OF ty_tfacs.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_jahr FOR tfacs-jahr MODIF ID b1.
    SELECT-OPTIONS : mon FOR tfacs-mon01  MODIF ID b1.
    SELECT-OPTIONS :  s_month FOR vbrk-erdat MODIF ID b2.
    SELECTION-SCREEN : END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
    PARAMETERS  r1 RADIOBUTTON GROUP c DEFAULT 'X' USER-COMMAND flag .
    PARAMETERS  r2 RADIOBUTTON GROUP c .
    SELECTION-SCREEN END OF BLOCK b.
             INITIALIZATION
    INITIALIZATION.
    AT SELECTION-SCREEN OUTPUT.
      IF r1 NE space.
        LOOP AT SCREEN.
          IF screen-group1 EQ 'B2'.
            screen-output = 1.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 EQ 'B1'.
            screen-output = 1.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
              start - of - selection
    start-of-selection.
      IF r1 = 'X'.
        PERFORM get-data.
        PERFORM display-data.
      ENDIF.
    &      form  get-data
           text
      -->  p1        text
      <--  p2        text
    form get-data .
      DATA :  total1  TYPE i.
      SELECT * FROM tfacs INTO TABLE ty_tfacs
                                     WHERE ident EQ 'IN'
                                     AND   jahr IN s_jahr.
      LOOP AT  ty_tfacs WHERE ident = 'IN'.
        IF sy-subrc EQ 0.
          PERFORM get_string USING ty_tfacs-string1
                                   ty_tfacs-mon01
                                   ty_tfacs-total1.
          PERFORM get_string USING ty_tfacs-string2
                                    ty_tfacs-mon02
                                    ty_tfacs-total2.
          PERFORM get_string USING ty_tfacs-string3
                                   ty_tfacs-mon03
                                   ty_tfacs-total3.
          PERFORM get_string USING ty_tfacs-string4
                                         ty_tfacs-mon04
                                         ty_tfacs-total4.
          PERFORM get_string USING ty_tfacs-string5
                                         ty_tfacs-mon05
                                         ty_tfacs-total5.
          PERFORM get_string USING ty_tfacs-string6
                                         ty_tfacs-mon06
                                         ty_tfacs-total6.
          PERFORM get_string USING ty_tfacs-string7
                                         ty_tfacs-mon07
                                         ty_tfacs-total7.
          PERFORM get_string USING ty_tfacs-string8
                                         ty_tfacs-mon08
                                         ty_tfacs-total8.
          PERFORM get_string USING ty_tfacs-string9
                                         ty_tfacs-mon09
                                         ty_tfacs-total9.
          PERFORM get_string USING ty_tfacs-string10
                                         ty_tfacs-mon10
                                         ty_tfacs-total10.
          PERFORM get_string USING ty_tfacs-string11
                                         ty_tfacs-mon11
                                         ty_tfacs-total11.
          PERFORM get_string USING ty_tfacs-string12
                                         ty_tfacs-mon12
                                         ty_tfacs-total12.
        ENDIF.
        ty_tfacs-uk = ty_tfacs-total1 + ty_tfacs-total2
                      + ty_tfacs-total3 + ty_tfacs-total4
                      + ty_tfacs-total5 + ty_tfacs-total6
                      + ty_tfacs-total7 + ty_tfacs-total8
                      + ty_tfacs-total9 + ty_tfacs-total10
                      + ty_tfacs-total11 + ty_tfacs-total12.
        MODIFY  ty_tfacs TRANSPORTING  total1 total2 total3
                                       total4 total5 total6
                                       total7 total8 total9
                                       total10 total11 total12
                                       uk.
      ENDLOOP.
    PERFORM write1-data USING 'COU' 'YEAR' 'MONTH01'
                               'MONTH02' 'MONTH03' 'MONTH04'
                               'MONTH05' 'MONTH06' 'MONTH07'
                               'MONTH08' 'MONTH09' 'MONTH10'
                               'MONTH11' 'MONTH12' 'TOTAL WDAYS' .
    LOOP AT ty_tfacs.
       PERFORM write1-data USING ty_tfacs-ident ty_tfacs-jahr
                                 ty_tfacs-total1 ty_tfacs-total2
                                 ty_tfacs-total3 ty_tfacs-total4
                                 ty_tfacs-total5 ty_tfacs-total6
                                 ty_tfacs-total7 ty_tfacs-total8
                                 ty_tfacs-total9 ty_tfacs-total10
                                 ty_tfacs-total11 ty_tfacs-total12
                                 ty_tfacs-uk.
    ENDLOOP.
    ENDFORM.                    " get-data
    TOP-OF-PAGE.
      FORMAT COLOR 5 ON.
      WRITE :/10 'COUNTRY',
              20 'YEARS',
              35 'MON01',
              45 'MON02',
              55 'MON03',
              65 'MON04',
              75 'MON05',
              85 'MON06',
              95 'MON07',
              105 'MON08',
              115 'MON09',
              125 'MON10',
              135 'MON11',
              145 'MON12',
              170 'total wdays'.
      FORMAT COLOR OFF.
      WRITE :/ SY-ULINE.
    *&      Form  display-data
          text
    -->  p1        text
    <--  p2        text
    FORM display-data .
      LOOP AT ty_tfacs.
        WRITE :/10 ty_tfacs-ident,
                20 ty_tfacs-jahr,
                30 ty_tfacs-total1,
                40 ty_tfacs-total2,
                50 ty_tfacs-total3,
                60 ty_tfacs-total4,
                70 ty_tfacs-total5,
                80 ty_tfacs-total6,
                90 ty_tfacs-total7,
               100 ty_tfacs-total8,
               110 ty_tfacs-total9,
               120 ty_tfacs-total10,
               130 ty_tfacs-total11,
               140 ty_tfacs-total12,
               150 ty_tfacs-uk.
      ENDLOOP.
    ENDFORM.                    " display-data
    *&      form  get_string
          text
         -->p_0250   text
         -->p_0251   text
         -->p_0252   text
    form get_string  using    p_0250   " month
                              p_0251   " string
                              p_0252.  " total
    p_0250 = p_0251.  " move month to string
    TRANSLATE p_0250 USING '0 ' . " translate
    CONDENSE p_0250  NO-GAPS.     " condense
    p_0252 = STRLEN( p_0250 ).    " pass length of string to total
    ENDFORM.                    " get_string
    ***&      Form  write1-data
          text
         -->P_0306   text
         -->P_0307   text
         -->P_0308   text
         -->P_0309   text
         -->P_0310   text
         -->P_0311   text
         -->P_0312   text
         -->P_0313   text
         -->P_0314   text
         -->P_0315   text
         -->P_0316   text
         -->P_0317   text
         -->P_0318   text
         -->P_0319   text
         -->P_0320   text
    *form write1-data  using    p_0306
                              p_0307
                              p_0308
                              p_0309
                              p_0310
                              p_0311
                              p_0312
                              p_0313
                              p_0314
                              p_0315
                              p_0316
                              p_0317
                              p_0318
                              p_0319
                              p_0320.
    *WRITE :/ p_0306,
            p_0307,
            p_0308 left-justified,
            p_0309 left-justified,
            p_0310 left-justified,
            p_0311 left-justified,
            p_0312 left-justified,
            p_0313 left-justified,
            p_0314 left-justified,
            p_0315 left-justified,
            p_0316 left-justified,
            p_0317 left-justified,
            p_0318 left-justified,
            p_0319 left-justified,
            p_0320 left-justified.
    *ENDFORM. " write1-data
    from this report what i am getting is year and its 12 months but my requirement is i will give date using select options and i should get the total no of  working days in b/w this date.

    Use the following code to find no of working days b/w given date. Use the correct factory_calendar_id in the function module. L_DAYS will display the required result:
    PARAMETERS: p_date1 TYPE sydatum,
               p_date2 TYPE sydatum.
    DATA: date1        LIKE scal-date,
         date2        LIKE scal-date,
         correction   LIKE scal-indicator,
         calendar     LIKE scal-fcalid,
         factorydate1  LIKE scal-facdate,
         workday1      LIKE scal-indicator,
         factorydate2  LIKE scal-facdate,
         workday2      LIKE scal-indicator,
         l_days TYPE scal-facdate.
    CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
      EXPORTING
        date                       = p_date1
        correct_option             = '+'
        factory_calendar_id        = 'US'
      IMPORTING
        date                       = date1
        factorydate                = factorydate1
        workingday_indicator       = workday1
      EXCEPTIONS
        correct_option_invalid     = 1
        date_after_range           = 2
        date_before_range          = 3
        date_invalid               = 4
        factory_calendar_not_found = 5.
    IF sy-subrc = 0.
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          date                       = p_date2
          correct_option             = '+'
          factory_calendar_id        = 'US'
        IMPORTING
          date                       = date2
          factorydate                = factorydate2
          workingday_indicator       = workday2
        EXCEPTIONS
          correct_option_invalid     = 1
          date_after_range           = 2
          date_before_range          = 3
          date_invalid               = 4
          factory_calendar_not_found = 5.
      IF sy-subrc = 0.
        l_days = factorydate2 - factorydate1.
        WRITE: / l_days.
      ENDIF.
    ENDIF.

  • How to get the last(latest or previous) working day

    hi,
    using sysdate we may be getting today's date and sysdate-1 will be fetching the yesterday's date. but if sysdate-1 turns to be sunday or a holiday then we need to get the previous date to that holiday date .THe list of holidays are in lt_list_holidays. The Holiday date shall be the holiday_date column. I need a query which displays the last (latest or previous) working day ..
    Please advice
    Edited by: vine on Jul 20, 2010 5:30 AM
    Edited by: vine on Jul 20, 2010 5:51 AM

    Hi,
    vine wrote:
    hi ,
    THe queery seems to be fine but in the middle if we have any holidays and the holidays are in lt_list_holidays table . the name of the holiday date is holiday_date in lt_list_holiday.Is the name of the holiday important? I'll assume not. I'll also assume you have a column d (a DATE) that is the date of the holiday.
    >
    Please adviceThat's quite a different problem from what you first posted.
    Instead of posting a question x, waiting for someone to answer it, and then saying that the problem is really y, don't you think it would be better to post question y in the first place?
    You can do something like this:
    WITH     prev_days     AS
         SELECT     TRUNC (SYSDATE) - LEVEL     AS a_date
         FROM     dual
         CONNECT BY     LEVEL <= 4     -- worst case (see below)
    SELECT     MAX (a_date)     AS previous_work_day
    FROM     prev_days
    WHERE     TO_CHAR (a_date, 'Dy', 'NLS_DATE_LANGUAGE=''ENGLISH''')
                   NOT IN ('Sat', 'Sun')
    AND     NOT EXISTS ( SELECT  1
                   FROM    lt_list_holiday
                   WHERE   d     = prev-days.a_date
    ;Where I work, holidays are never consecutive, in fact, they are always at least 7 days apart, so I can be sure that a period of 4 consectuive days will always contain at least one work day. (There may be two weekend days plus one holiday; that's the worst case.) If you can have two or more holidays in a row, or holidays spaced 3 days apart (so that one might fall on a Friday, and the other on Monday), then increase the "magic number" 4 in
         CONNECT BY     LEVEL <= 4     -- worst caseto something appropriate. If you put it too high (say 10), no serious harm is done.

  • Need working days for a particular month and year

    Hi,
    I need the number of working days for a particular month and year.Saturdays and Sundays are holidays.
    Regards,
    Vignesh

    Try this:
    SQL> var yr NUMBER;
    SQL> exec :yr := 2010;
    PL/SQL procedure successfully completed.
    SQL> with t as (select :yr yr from dual)
      2  SELECT TO_CHAR(dat,'MON-RR'),COUNT(*) FROM
      3  (select TO_DATE('01-JAN-'||yr) + lv dat FROM
      4  (select level - 1 lv,yr from t
      5  connect by level <= TO_DATE('31-DEC-'||yr) - TO_DATE('01-JAN-'||yr) + 1))
      6  WHERE TO_CHAR(Dat,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(dat,'MON-RR');
    TO_CHAR(DAT,   COUNT(*)
    APR-10               22
    AUG-10               22
    DEC-10               23
    FEB-10               20
    JAN-10               21
    JUL-10               22
    JUN-10               22
    MAR-10               23
    MAY-10               21
    NOV-10               22
    OCT-10               21
    TO_CHAR(DAT,   COUNT(*)
    SEP-10               22
    12 rows selected.
    SQL> Edited by: AP on Jul 27, 2010 7:54 AM

Maybe you are looking for

  • New iTunes Library doesn't see .aif file

    I gathered my music into one new library on a new external HD but it didn't gather in the .aif file I made as an audio track for a movie. I can see it and click on it but it comes up with a QuickTime player window. If I play it, the track plays but d

  • WARNING - Oracle intends to desupport Forms client server mode

    When Forms 6i becomes desupported you will have to move to Forms 9i. Forms 9i runtime can only be run in web mode from a web browser. You will not be able to run client-server forms in native operating systems such as Windows or Unix. The forms will

  • View RX neighbors for selected radio does not show any information

    For some but not all of our WLCs, our WCS is not able to View RX neighbors for selected Radio in the maps. WLC is running 4.1.171-code, WCS is using 4.1.83 Base+Location. I use Monitor-Maps, slecet a map and hover with my mouse over one of the APs to

  • How do I set up an MS Stereo Pair in Logic 7?

    So we are now dabbling into the MS Stereo pair for our recording tech class and I can't seem to find an easy way of doing this. Any suggestions? I can't find a real time phase inversion plug-in or button anywhere other than going through the wave edi

  • OMG \DAQ 3005 problem reading LVDT voltages

    Hello everyone....  I'm having a very frustrating time reading simple LVDT data with a DAQ 3005 and DasyLab...  I'm a structural engineer with limited DAQ experience, so I'd appreciate any help you might provide.   The situation is as follows...    I