Query for geetiing no.of working days

Hi All,
How can we write a query for geetiing no.of working days in Oracle Apps.
Basically we need to mention no.of working days in the Work-Flow Form but not the no.of days.
So how can we write a query for getting no.of working days.and Where can we get the tables?
Is there any need of calendar in WIP(Work in Process) Module?
Can any one please help me out.
Thanks in Advance,
Dhana

Hi,
Please see if these documents help.
Note: 43276.1 - Calculating the Number of Working Days
Note: 1018913.102 - How to Find Number of Days - Valid Working Days - Between Two Dates
Regards,
Hussein

Similar Messages

  • Query for back 2nd motnh first day and last day

    Any body please provide me the query for back 2nd month first day to back 2nd month last day?
    last month first day
    TIMESTAMPADD(SQL_TSI_MONTH,-1, TIMESTAMPADD(SQL_TSI_DAY, -(DAY(CURRENT_DATE)-1), CURRENT_DATE))
    last month last day
    TIMESTAMPADD(SQL_TSI_DAY, -(DAY(CURRENT_DATE)), CURRENT_DATE)
    anyone please provide me the queries for previous months like above queries?
    2nd back month first day --?
    2nd back month last day--?
    3rd back month first day --?
    3rd back month last day --?

    Hi,
    Check with this...
    Previous month last day -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)
    Last day of 2nd month -
    TIMESTAMPADD(SQL_TSI_MONTH,-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    Last day of 3rd month -
    TIMESTAMPADD(SQL_TSI_MONTH,-2,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    (OR)
    Previous month last day -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)
    Last day of 2nd month -
    TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))
    Last day of 3rd month -
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)))*-1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))*-1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE)))
    Regards,
    Srikanth

  • 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

  • Infotype for salary According to working Days

    Helloo Experts,
    Please tell me Is there any Infortype where i can see salary of an Employee according to current month working Days,
    Suppose i want to see the salary of ABC employee today Where Working Days are only 15 days from 1st Dec to 18 Dec,
    Can you Please tell me is there any infotype to see Salary of Employee According to working day.
    Regards
    Shelly Malik

    Hi
    Check with info type 0002,0003,0005,0007,0008 and 0009.
    Table names :PA0002,PA0003,PA0005,PA0007,PA0008 and PA0009.
    Regards
    Srilaxmi

  • SQL Query for Chart does not work

    Have written a query that works fine outside of the app, but no data returned (displayed) within the app. I suspect i could simply create a view with the query in and all would be fine, but i'm intrigued to know why it will not yield data as is. Any ideas? Here's the query:
    select * from
    select null link, period, data from (
    select dp3.period, dp3.data-dp14.data data from
    (select period, data from ml_data_daily
    where data_point = 3
    and category = 'A. 0'
    and period_type = 'DAY'
    and period >= (select period from ml_period where period_number = :p1_date_start)
    and period <= (select period from ml_period where period_number = :p2_date_end)
    ) dp3,
    (select period, data from ml_data_daily
    where data_point = 14
    and category = 'Invalid Search'
    and period_type = 'DAY'
    and period >= (select period from ml_period where period_number = :p1_date_start)
    and period <= (select period from ml_period where period_number = :p2_date_end)
    ) dp14
    where dp3.period=dp14.period
    order by period)
    )

    Bruce - Make sure the items accessed via the bind variables have been set in session state. If those are just search fields, the chart query won't see them until the page has been submitted.
    Scott

  • Dell b1160w printing wirelessly fine for months.. quit working days ago

    good evening
    i have a dell b1160w printer.  working great for weeks.. suddenly stopped working.. tried reinstalling drivers.. prints a test page.. but test page says install proper driver.. help!

    Alan Barnes,
    You may need to uninstall  the printer and reinstall it back into your computer. You can download the driver from the link below.
    B1160W Drivers

  • Query to retrieve previous working day?

    I need to write a query that will retrieve the previous working day. Therefore, it must exclude weekends and holidays.
    For example, the previous working day for Saturday, February 19 or Sunday, February 20 would be Friday, February 18. And since Monday, February 21 was a holiday for us then the previous working day would also be Friday, February 18.
    I've found some queries that allow me to find the previous working day excluding weekends, but I'm having difficulty with the holidays aspect. We have a table called CORPHOLIDAY that contains a field HOLIDAY that stores the holiday dates.
    Can I do this with a simple query? I'm not proficient with Oracle, so any and all help is appreciated. Thanks!

    Welcome to the forum!
    As Dan said, whenever you have a question, it really helps if you post CREATE TABLE and INSERT statements to create whatever tables you need, so people can re-create the problem and test their ideas. Also post the results you want from that data, and your version of Oracle.
    The sample data might be as simple as this:
    CREATE TABLE     corpholiday
    (     holiday     DATE
    INSERT INTO corpholiday (holiday) VALUES (DATE '2011-02-21');Here's one way to get the results you want. You enter a starting date (such as February 22, 2011) and the query produces the last working day before that date (in this case, February 18).
    WITH     consecutive_days     AS
         SELECT     TO_DATE ( '22-Feb-2011'     -- Input parameter
                   , 'DD-Mon-YYYY'
                   ) - LEVEL     AS a_date
         FROM     dual
         CONNECT BY     LEVEL     <= 4     -- 1 + Max. possible non-work days
    SELECT     MAX (a_date)     AS prev_work_day
    FROM           consecutive_days     c
    LEFT OUTER JOIN      corpholiday          h  ON     c.a_date     = h.holiday
    WHERE     TO_CHAR ( a_date
              , 'Dy'
              , 'NLS_DATE_LANGUAGE=ENGLISH'     -- If necessary
              )     NOT IN ('Sat', 'Sun')
    AND     h.holiday     IS NULL
    ;What you might really like for this job is a WHILE loop, something that would start at the given date, subtract one, test if that day was a work day, and, if necessary, repeat until it did find a work day. That's how you might do it in a procedural language, like PL/SQL, and that's exactly what a lot of people would do: write a PL/SQL function, that could us a WHILE loop. SQL is a non-procedural language, so it doesn't have anything like a loop. Using a CONNECT BY query, as shown above, we can simulate the behavior of a FOR loop, where we do a fixed number of iterations. The query above works by using CONNECT BY to generate the last 4 dates before the given starting date. What is that magic number 4? It's the worst case of how many consecutive days there can be (at least where I work) that is sure to have at least one work day. Where I work, holidays are always at least a week apart, so the longest you can go without a work day is like the example you gave: a Monday (or Friday) holiday, adjacent to the 2 weekend days. You may need to change the number 4 to something higher if, say, December 25 and 26 were both holidays, or if Good Friday and Easter Monday were both holidays.
    As posted, the query above works in Oracle 9 (and up), but it can be modified for earlier versions.
    Edited by: Frank Kulash on Feb 23, 2011 8:57 PM
    Added explanation

  • Payment terms based on working days

    Dear colleagues
    I would like to base payment terms on, for example, the last working day of the month, or the last working day of the trimester instead of working with fixed days.
    Would someone know if this is possible and if so, how can that be arranged?
    Thanks and regards,
    Marlies

    Dear,
    as far as I know, this is not possible into the SAP Standard System.
    I'm sorry about it.
    Mauri

  • PCR - RPTIME00 - TM00 - how to find of exceeding of the working day

    Hello,
    I'm new in RPTIME00 I need to write a PCR - schema ZM00 (TM00) that find of exceeding of the working day and generate wage type 1506 for cluster B2?
    For example employee works:
    MO: DWS=06:00-14:00
    TU: DWS=06:00-14:00 but TI2011=04:00-14:00
    The point is that I must generate wage type only for time par 04:00-06:00 without generate of WT for overtime (M)
    I though that I need generate WT from PCR with ADDZLS1506 for example... but in this case I need to find exceeding of the working day
    Any ideas?
    I tried with this:
    APD1      *   ****           HRS=D0061
    APD1      *   ****           HRS?S
    APD1      *   ****  >        GCY APD2
    APD2      *   ****           OUTWPTIMER
    APD2      *   ****  1        HRS=SNTB  
    APD2      *   ****  1        HRS?PBEG
    APD2      *   ****  1 >      HRS=PNUM  
    APD2      *   ****  1 >      HRS?CTEPOL
    APD2      *   ****  1 > >    HRS=PNUM                    
    APD2      *   ****  1 > >    HRS?0
    APD2      *   ****  1 > > >  ADDZLS1506
    APD2      *   ****  1 > > >  COLOP*
    Thanks a lof for help.
    BR,
    M
    Edited by: mn-sdf on Jul 6, 2011 10:59 AM
    Edited by: mn-sdf on Jul 6, 2011 11:20 AM

    Thanks for answer but I don't need generate overtime beyond the planned working hours in the end of month. I have WT in PY for additional pay for "exceeding of the working day" (this is not overtime but ... salary supplement? My english is not good enough, sorry).
    I don't need approval for overtime (via 2007 and GOT...) which give me "M" pair type for this case (WT1506). I don't need them. Opposite this I need to find:
    previous day was free or not?
    when was a free day, I don't have to generate 1506
    when is a working day, I have to generate 1506
    My PCR generate WT1506 correctly but on every day where I have start hour (2011) before start working time from DWS.
    Maybe the point is how to find the previous day was free or not?
    Do you know how to do it?
    Thanks a lot!
    BR,
    MN
    Edited by: mn-sdf on Jul 6, 2011 12:41 PM

  • How to query for foreign encoded text via REST service

    I am using APEX 4.2.1.00.08 to publish RESTful web services that query a table of place names. The place names include foreign encoded alternates. My search field has type of NVARCHAR2 and the db has NLS_CHARACTERSET of AL32UTF8. Querying for foreign encoded names works fine from other applications (e.g. TOAD, ArcGIS).
    In APEX under 'SQL Workshop | RESTful Services' I have created a module, resource template, and resource handler. When I use 'Set Bind Variables' to test the service, it works for 'English' names with no problem (e.g. 'London').
    However, when I query for a foreign equivalents like 'ロンドン', the Japanese version of 'London', I get the following error:
    400 - Bad Request
    The request path contains illegal characters
    How do I get foreign encoded place names to work as the bind variable value of a REST service?

    Does this query help?
    select /*+ parallel(4) */
    pk.table_name parent_table_name, pk.constraint_name pkey_constraint,
    fk.table_name child_table_name, fk.constraint_name fkey_constraint, fk.r_constraint_name
    from
    user_constraints pk,
    user_constraints fk
    where
    pk.constraint_name = fk.r_constraint_name
    and pk.constraint_type='P'
    and fk.constraint_type='R'

  • Need working days for all months in a given year

    Hi,
    I need no of working days for all the months in a given year.
    (i.e year is the input and the query should return 12 columns(jan-dec). Saturday and Sunday are holidays)
    Regards,
    Vignesh

    Maybe you can use this:
    break on month skip 1
    set linesize 200
    set pagesize 2000
    column month format a20
    column week format a4
    with req as (select '&Required_Year_YYYY' as yr from dual)
        ,offset as (select case when to_char(trunc(to_date(yr,'YYYY'),'YYYY'),'IW') in ('52','53') then 1 else 0 end as offset from req)
    select lpad( Month, 20-(20-length(month))/2 ) month,
           '('||week||')' as week, "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"
    from (
      select to_char(dt,'fmMonth YYYY') month,
      case when to_char(dt, 'mm') = '12' and to_char(dt,'iw') = '01' and offset = 0 then '53'
           when to_char(dt, 'mm') = '12' and to_char(dt,'iw') = '01' and offset = 1 then '54'
           when to_char(dt, 'mm') = '01' and to_char(dt,'iw') in ('52','53') then '1'
           else to_char(to_number(to_char(dt,'iw'))+offset) end as week,
      max(decode(to_char(dt,'d'),'1',lpad(to_char(dt,'fmdd'),2))) "Su",
      max(decode(to_char(dt,'d'),'2',lpad(to_char(dt,'fmdd'),2))) "Mo",
      max(decode(to_char(dt,'d'),'3',lpad(to_char(dt,'fmdd'),2))) "Tu",
      max(decode(to_char(dt,'d'),'4',lpad(to_char(dt,'fmdd'),2))) "We",
      max(decode(to_char(dt,'d'),'5',lpad(to_char(dt,'fmdd'),2))) "Th",
      max(decode(to_char(dt,'d'),'6',lpad(to_char(dt,'fmdd'),2))) "Fr",
      max(decode(to_char(dt,'d'),'7',lpad(to_char(dt,'fmdd'),2))) "Sa"
      from ( select trunc(to_date(req.yr,'YYYY'),'y')-1+rownum dt
             from all_objects, req
             where rownum <= add_months(trunc(to_date(req.yr,'YYYY'),'y'),12) - trunc(to_date(req.yr,'YYYY'),'y') )
          ,offset
      group by to_char(dt,'fmMonth YYYY'),     case when to_char(dt, 'mm') = '12' and to_char(dt,'iw') = '01' and offset = 0 then '53'
                                                    when to_char(dt, 'mm') = '12' and to_char(dt,'iw') = '01' and offset = 1 then '54'
                                                    when to_char(dt, 'mm') = '01' and to_char(dt,'iw') in ('52','53') then '1'
                                                    else to_char(to_number(to_char(dt,'iw'))+offset) end
      ) x
    order by to_date( month, 'Month YYYY' ), to_number(x.week)
    / L.

  • Finding number of working days during query execution

    Hi ,
    We have a requirement to calculate number of working days during query execution. In the cube we got "received date", this will be used as a variable in the query. Based on the received date value entered, query needs to display number of products received from past 1, 2,3,4 days (working days should include weekends or public holidays).
    1day     2 days     3 days     4 days   5 days 
    10         12            20            15          20
    to me it appears as I need to create virtual key figures.
    Regards,
    Ramz

    Hi ramesh,
    First try to create formula variables for start data and end date to calculate the no of working days.
    Create a Variable ZSTDT --of type replacement path.
    Type of Variable = Formula
    Variable Name = ZSTDT
    Characteristic = <info object>
    For Intervals Use = Select From Value
    Offset Start = 0000 Offset Length = 0000
    Replacement var with : key
    use the same steps to create one more formula variable to get end date.
    Now create a formula to get the No of days.
    once after getting no of days you can create buckets as per your need.
    for more info check the below links
    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc?quicklink=index&overridelayout=true

  • Query for last 8 days results

    any body have a query for last 8 days results
    TIMESTAMPADD(SQL_TSI_DAY, -8, CURRENT_DATE) this is resulting only 1 day results only .if i execute this query is it displaying 8th back day results only.
    i want all 8 back days results .
    anybody have query for this...
    Edited by: user12255470 on Apr 28, 2010 7:19 AM

    This works fine for me:
    SELECT "D0 Time"."T00 Calendar Date" saw_0, "F1 Revenue"."1-01 Revenue (Sum All)" saw_1 FROM "Sample Sales" WHERE "D0 Time"."T00 Calendar Date" BETWEEN TIMESTAMPADD(SQL_TSI_DAY, -8, CURRENT_DATE) AND TIMESTAMPADD(SQL_TSI_DAY, -1, CURRENT_DATE) ORDER BY saw_0
    regards
    John
    http://www.obiee101.blogspot.com/

  • Get the number of working days based on factory calendr for a range of mont

    Dear all,
    We are using BI7.00 . In one of our reports we have the following requirement.
    The range of months will be given in the selection screen for example 01.2008 to 11.2008, when the query is executed, i want system to calculate the number of working days for each month of the year (for what values provided in the selection field ) and display the same. i.e., as mentioned below.
    Month                         days.
    01.2008                        22
    02.2008                        18
    03.2008                        25  etc., Kinldy provide steps for adopting the same. If it can be adopted only through customer exit also provide the code and parameters that has to be used.
    Regards,
    M.M

    hi,
    Try the following logic to find out the no.of working days in a month based on your calendar.
    parameters : mny(6).    " input format should be  yyyymm
    data : d1 like sy-datum,
           d2 like sy-datum,
           d3 like sy-datum,
           v_nds type i.
    concatenate  mny '01' into d1.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
      EXPORTING
        DAY_IN            = d1
      IMPORTING
        LAST_DAY_OF_MONTH = d2
      EXCEPTIONS
        DAY_IN_NOT_VALID  = 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.
    do 30 times.
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          CORRECT_OPTION      = '+'
          DATE                = d1
          FACTORY_CALENDAR_ID = ' A'    " your factory calendar ID
        IMPORTING
          DATE                = d3.
      if d1 = d3.
        d1 = d1 + 1.
        v_nds = v_nds + 1.
      else.
        d1 = d3.
      endif.
      if d3 ge d2.
        exit.
      endif.
    enddo.
    write : 'No of working days ', v_nds.
    hope it helps...
    regards,
    raju

  • 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

  • Create XML dynamically from schema and Java bean

    Hi, I'm looking for suggestions on the best approach to create an XML file programatically from a schema and Java bean. The schema used is not fixed and may vary with each request so a dynamic way to create the XML is required. Is there an API availa

  • No video on capture via panasonic deck - NEW

    Hi. I rented a panasonic deck HD1400 to get tapes captured in Final Cut Pro 5.04. When trying to capture I get no video on the Mac Book Pro. I use Easy Set-up DVC-PRO HD1080i50 which correspond to tapes. Also the deck is set to HD1080i. I can control

  • Reversal of Reversed Outbound Delivery

    SAP Gurus, Is it possible to reverse a Reversed Outbound Delivery? I mistakenly used a wrong document date and want to repost a reversed outbound delivery document with a correct date. Thank you, Pravin Ambardekar

  • Adobe X Pro won't download

    Adobe X Pro won't download.  I t partially downloads and then says I have a corrupt file.  Tried different locations and get the same error message.  Am using Firefox browser and have never had any touble downloading Adobe Reader X or other companies

  • Instalation of Service Release 3

    Hi, i`m going to install SR? on CCM 4.1. I hope that issue about tranfer call (when IP telephone try to ransfer and make a blind tranfer, any other telephone can capture this call) but i?m not completly sure. Someone could tell me something about thi