Updating work hours

Greetings everyone,
I'm trying to update a field in a table with the total work hours in a specific month. To achieve this I've tried using a piece of SQL found in several other threads to retrieve the number of work days in a month. This doesn't work properly in my case however, since the subquery doesn't know the reference to a field on a higher level. Here is the SQL:
UPDATE PS_EMPL_WRK_HRS Z SET WRK_HRS = (
SELECT Z.STD_HOURS * (SELECT COUNT(*)
    from (select trunc(Z.EFFDT, 'mm')+level-1 dt
           FROM   DUAL
           connect by level <= last_day(Z.EFFDT) - trunc(Z.EFFDT, 'mm')+1
    where to_char(dt, 'dy' ) not in ('sat', 'sun'))  END AS WRK_HOURS
FROM PS_GENL_DEDUCT_NLD GD
WHERE   Z.EMPLID = GD.EMPLID
  AND Z.EMPL_RCD = GD.EMPL_RCD
  AND (GD.DEDUCTION_END_DT >= Z.EFFDT OR GD.DEDUCTION_END_DT IS NULL)
)The error message will be ORA-00904: "Z"."EFFDT": invalid identifier, because the subquery to retrieve the number of workdays in a month doesn't know about the Z alias.
The PS_EMPL_WRK_HRS contains the EMPLID, EFFDT and STD_HOURS. For each employee the record contains one row for each last day of the month, which is stored in the EFFDT field.
Any help would be appreciated!
CREATE TABLE PS_EMPL_WRK_HRS (EMPLID VARCHAR2(11) NOT NULL,
   EFFDT DATE,
   STD_HOURS DECIMAL(6, 2) NOT NULL,
   WRK_HOURS DECIMAL(6, 2)
Insert into PS_EMPL_WRK_HRS (EMPLID,EFFDT,STD_HOURS) values ('010382',to_date('31-05-2013','DD-MM-RRRR'),40);
Insert into PS_EMPL_WRK_HRS (EMPLID,EFFDT,STD_HOURS) values ('010382',to_date('30-04-2013','DD-MM-RRRR'),40);
Insert into PS_EMPL_WRK_HRS (EMPLID,EFFDT,STD_HOURS) values ('010382',to_date('31-03-2013','DD-MM-RRRR'),40);
Insert into PS_EMPL_WRK_HRS (EMPLID,EFFDT,STD_HOURS) values ('010382',to_date('28-02-2013','DD-MM-RRRR'),40);
Insert into PS_EMPL_WRK_HRS (EMPLID,EFFDT,STD_HOURS) values ('010382',to_date('31-01-2013','DD-MM-RRRR'),40);Edited by: Michel on Feb 5, 2013 3:53 PM - Added CREATE and INSERT script

Fixed it already:
UPDATE PS_EMPL_WRK_HRS Z SET  WRK_HOURS  = (
CASE WHEN (SELECT
1
FROM PS_GENL_DEDUCT_NLD GD
WHERE   Z.EMPLID = GD.EMPLID
  AND Z.EMPL_RCD = GD.EMPL_RCD
  AND (GD.DEDUCTION_END_DT >= Z.EFFDT OR GD.DEDUCTION_END_DT IS NULL)) = 1
THEN 1 ELSE (Z.STD_HOURS - Z.DED_HRS_ILL_K ) * (SELECT COUNT(*)
        FROM
          (SELECT rownum rnum
          FROM ps_country_tbl
          ) Y
        WHERE y.rnum <= Z.EFFDT - to_date(TO_CHAR(Z.EFFDT,'YYYY-MM')||'01','YYYY-MM-DD') + 1
        AND TO_CHAR( Z.EFFDT + Y.RNUM - 1, 'D' ) NOT IN ( '1', '7' )
        ) END );

Similar Messages

  • Assigned Working Hours Display

    Hi,
    For evaluating Workforce Management, I am running transaction CM50 for specific Work Center and have followig data for this WORK CENTER -
      Entries  -        Rem.cap.reqs   -   Avail.capacity -   Rem.a -     Rem. avail. capaci
      Total     ---  ---    222,012 HR      --- ---    824,0 HR       ---    --- --- --- ---  --- --- ---   601,988  HR
    25.03.2011   ---          7,048 HR   ---   ---       8,0 HR      --- --- ---  --- ---  88,1 ---       ---     0,952  HR
    26.03.2011   ---         3,524 HR    ---   ---      8,0 HR       ---  --- ---  --- --- 44,1 ---        ---     4,476  HR
    27.03.2011   ---         3,524 HR    ---   ---       8,0 HR       --- --- ---  --- ---  44,1 ---        ---     4,476  HR
    28.03.2011   ---         3,524 HR    ---   ---      8,0 HR       --- --- ---  --- ---  44,1 ---        ---     4,476  HR
    29.03.2011   ---         3,524 HR    ---   ---      8,0 HR       --- --- ---  --- ---  44,1 ---        ---     4,476  HR
    Here 222,012 HR is the Rem.Cap.Requested hours.
    From CMP3 Transaction, for a employee, I am booking 3 hours daily from 26.03.11 to 29.03.2011(total 12 hours). When I am again running CM50 Transaction, these 12 hours should also add in 222.012 Hours because it's already allocated and I must see - 234 Hours updated. But I am not able to see that. Am I running wrong transaction to review the updated data or am missing something else so that I will get updated Working Hours evaluation data, everytime I allocate hours to someone. Please let me know. Shall I see some other transaction?
    Thanks and Regards,
    Roshan Gupta
    Edited by: Roshan Gupta on Mar 25, 2011 3:22 PM

    Solved by myself.
    In this case, planned working hours was not changing the reports data that I illustrated above. Actual Working hour was affecting the data.
    Thanks,
    Roshan

  • Time updation for Support desk message and business calender working hours

    Hi Experts,
    I would like to know how to set the time updation of Support desk message in CRM_DNO_MONITOR. After i receive a new message in it, I can see the from timing and to timing (even after changing the status of message) as 00:00:00. Is there any standard job to automatically update the timing of message?
    Also i would like to know, how to set the working hours for various days. Lets say i want to set my business hours for Monday from 10am to 6pm and for Tuesday as 9am to 5pm.
    Suitable points will be rewarded.
    Thanks in advance,
    Naresh Dodeja.

    Hi,
    The reason is "created by me" selects the role "Creator" of a message/notification.
    There are three roles "Creator", "Contact" or "Reporter" and "Responsible" or "Processor".
    The creator is identified by his user name and the others by their BP-ID.
    Therefore using the report "created by me" does not work if your users are defined for BPgen only.
    That it works you have additionally to define in BP the role "BUP003 - Employee".
    You find in the transaction BP for "BUP003 - Employee" in the tab "identfication" a field "User Name".
    If you enter the User-ID the user  has in the Solution Manager then it works.
    Good look!
    Best regards,
    Adelbert

  • How to update capacity util. level & Work hours in IT -8

    Dear Concern,
    There is a problem in updating capacity util. level & Work hours in IT -8 in the T -Code -PA30. It is still showing Capacity 0% & Work Hours -0 hr monthly. We have already  updated the same as 100% & 208 hr. monthly in Info Type-7 , inspite of then, the same has not been automatically updated in Infotype 8..
    Please advice how can we update Capacity Utilisation & Working hours in the Infotype 8 as  we have already updated it in the Infotype 7.
    Thx

    You cannot show a specific timespan, e.g., 8AM to 5PM, and hide the remaining hours. However, you can highlight the working hours of the day by implementing getWorkingStartTime and getWorkingEndTime on the Resource.
    You can specify the workingTimeColor attribute (optional, there is a default) on Gantt to set the working time color.

  • Fixed Duration Tasks work hours not updating properly

     I have a task of 2 days duration which is fixed duration; with 1 resource assigned when it is 30%, I add 2 more resources to it as even though duration is same work hours need to be increased. But I don't see any impact on work even when 2 resources
    are added. M I missing something

    Just check if the check box - Effort Driven is checked for that task, as in this case whatever are the hours in Work field that gets equally distributed between all resouces (in your case the newly added and existing resource). Uncheck that box
    and then assign resources; this should fix your calculations for the expected hrs. adding to Work field.
    Sapna Shukla

  • Project 2013 - entering work hours at a monthly level

    Hi all, 
    Any help with this 'hopefully small' problem will be hugely appreciated. It's not so much a problem, but
    me still being new to Project - sorry! As a summary of what I am working with:
    I have entered a list of tasks (all set to Manually Scheduled).
    I have entered a number of resources into the Resource List. 
    I have also assigned relevant resources to the tasks. 
    Using the Task Usage view, I would now like to begin entering Work hours for the resources assigned to the
    tasks. We are planning at a monthly level, so I know how many hours each resource is expecting to be spending on each task over each month. 
    I have set the Timescale of my Task Usage screen to a monthly scale, thinking that this would allow me to
    enter total hours for each month. As an example, one of the resources assigned to a task is set for 15 hours of Work in April. It all seems to look OK on input. 
    My problem is however, I would like the Start and Finish fields to reflect this, and span over the months
    in which the Task's resources will be doing work. It doesn't seem to pick up the month accurately. Although I have entered the 15 hours in the column labelled April, the Start and Finish dates have come out as 30/04/14 and 30/05/14 respectively. I was hoping
    the Start and Finish times of that row to be 01/04/14 and 30/04/14 respectively, but they are a month out of line, and has show the work to be happening over May, not April. Is there y way I can change this?
    I hope this makes sense as a question? Any help at all would be brilliant. Please do let me know if I've
    missed any detail and you need some more info. I'll also continue looking through the forums to check if this has already been asked. 
    p.s. I tried to upload an annotated image, but my account needs to be verified first. Do I need to do anything to request this? I didn't receive any usual 'verification' links in MS's email on opening this account.
    Thanks very much, 
    ac18

    Hi John, Julie,
    Thank you both very much for the help! Yes good spot, I did post it on both forums (http://www.msofficeforums.com/project/21190-project-2013-entering-work-hours-monthly-level.html) - it's been years since I've used forums of any kind, and it's great to see
    experts being active across multiple sites! 
    I have given both suggestions a try, but unfortunately am still not quite there yet. 
    John, although your tip seems to work OK, I think I was hoping to find a way for the Start and Finish times to automatically span across the Work hours I have entered. If I was to then enter another 5 hours, but this time for March, the Start-Finish dates
    should auto update to be 01/03/14 - 30/04/14. I understand now that this may require me to be on an Automatically Scheduled project? 
    Julie, your screen shot on the msofficeforums.com website is exactly what I am looking to achieve! I would like to enter month-level Work data, and that looks to be exactly that. I did try entering a zero in the month immediately after the last month that
    had hours in it, but Project seemed to simply ignore it, with no visible change to the dates. 
    I have done some further investigating, and there does seem to be something different happening with my Project version (it's Proj Prof 2013). I have access to another computer with Project 2010 installed on it, and this doesn't seem to cause an issue. Note,
    I did need to have set the tasks as Auto Scheduled. 
    Essentially, if I try and exactly replicate Julie's example on both versions with the following steps, I get slightly different results:
    Tasks set to Auto-Scheduled. 
    Set Project Start Date to 01/01/14
    Enter some resources. 
    Switch to Task Usage view. 
    Set the Timescales on the right hand side to: Bottom tier=Months, Middle tier=Quarters. 
    Enter a task. 
    Assign resources to the task. At this point, by default 8 hours worth of work appears for each assigned resource. In 2010, these hours appear in the January 14 column. But on my 2013 laptop however, these hours appear under the December 2013 column. Strange?
    Anyway, in both cases I clear these default hours by entering zeros in their places.
    I now enter 15 hours under April 2014 for one of the resources on the task.
    In 2010, the Start and Finish dates of the assigned resource's row update to 01/04/14 - 30/04/14.
    In 2013 however, the Start and Finish dates update to 30/04/14 - 30/05/14. 
    I have a feeling that this discrepancy is perhaps at the heart of my problem? Is there a setting with the application that I am not making?
    Thanks again, 
    Arjun

  • A proprietary page I use for logging work hours is not compatible with 4.0. How can I downgrade?

    I use a work-hour logging site called "Infowit" to account for my time on the job. After downloading 4.0, I can no longer log in at the site. It tells me that my browser is not compatible with it.
    As a result, I want to go back to the older version I was using before. How do I do this?
    Thanks.

    To keep your computer and files safe, you should not go back to Firefox 9. Firefox 10 contains security fixes. You may be able to make your toolbar work by using the add-on compatibility reporter as described in this article [[Add-ons are disabled after updating Firefox]].
    If you really must go back to Firefox 9, you can find it here: https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/9.0.1/win32/

  • Std report for viewing emp working hours

    Hi all,
    I want to know what is the standard report available in HR module to view the Employee aproved working hours and Unapproved working hours...?
    Regards,
    Shanthi

    Hello,
    maybe you can find this data, at the PT62, PT64, PT65, PT90_ATT and PT91_ATT TRANSACTION CODES.
    Regards

  • In iCal, "Available Meeting Times" greys out working hours one day off, MS Exchange

    I am using iCal, accessing an MS Exchange server. When setting up a meeting, "Available Meeting Times" greys out the non-working hours of potential meeting participants. However, the days are one day off. E.g. the working hours of my collegues are displayed are Tuesday-Sunday instead of Monday-Friday. The dates and times of meetings are relayed correctly. Only the display of the working hours seems to be off.
    Needless to say that my collegues are using Windows Outlook, and everything works there.

    I still have the same issue. Had it ever since at least 2010 and meanwhile we switched Exchange-Servers and I'm on Mavericks, but still. Looks to me as if iCal requests something like "getWorkDays" from teh Server. The Server probably replies [2,3,4,5,6]. When the week starts on Sunday, this is perfectly fine. But if the Week starts on Monday, this will give you Tue-Sat as available Days. So it might be a bug in either Exchange or iCal to treat that information correctly, but I'm not obv. not sure about that.

  • How can i do a proper calculation of working hours?

    I have tried doing a calculation of my working hours using the ABS formula but it still gives me the wrong answer.
    5:00 PM
    1:00 AM
    16h
    the formula is =ABS(A1-A2)
    the resulte shoulb be 8h but it shows 16h....

    giltober wrote:
    Jerry,
    I start working at 5pm and finish in 1am which means i worked for 8 hours.
    the only way to get the correct answer is to enter the dates also?
    is there a formula that i can enter that will take in consideration that every time i work i start at the afternoon and finish after midnight?
    i have a cell that i enter the date..
    im still new to numbers and i dont know i to put that into consideration...
    thank you for your help
    Gil.
    That's right, my mistake on the detail. I must have been distracted. I stand by the rest of my post.
    Here's my approach to solving the problem:
    This will take care of the situation where you sometimes input both times on the same day even though they represent different days.
    Jerry

  • CRM 5.0 - IC WebClient - Due Date - Working Hours for Service Ticket

    Hi Gurus
    We're using a Service Ticket Transaction which has a Date Profile which provides a 48 Hour window for which the user must complete the Service Ticket Resolution.
    The issue is I want to tie this up to the Business working Hours. I just cannot figure out where I define the Business Working Hours.
    This is a Standalone CRM Implementation. Maximum points for the right answer.
    Many Thanks
    Panduranga

    Hi,
    The response time of 48 Hours must be maintianed in response profile... right?
    Similarly there is a availability profile in which you maintain the business hours/ availablity of your resources.
    These both together make a service profile.
    The availability profile is maintained in SAP Easy Access> Service> Service Contracts and Service Plans --> CRMD_SERV_SLA - Maintain Availability and Response Times
    Hope this will help
    Regards
    Rekha Dadwal

  • Calculation of working hours

    Hi all,
    I need a function module for the calculation of working hours. supose in the selection screen if i give 01.02.2007 to 01.10.2007 i need the calculation of working hours in that given range depending upon the personal number. Suppose if the employee is absent for 3 or 4 days within particular period of theat given range that days needs to be eliminated and should calculate for the rest of the days. Please find the below code iam finding a problem in this piece of code. Please this issue is very urgent please reply ASAP.
      gv_day = sy-datum - 7.
      CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'
        EXPORTING
          datum    = gv_day
          week_pst = 0
          week_ftr = 0
        IMPORTING
          begda    = gv_begda
          endda    = gv_endda.
      IF sy-subrc <> 0.
      ENDIF.
    *AT SELECTION-SCREEN OUTPUT.
      pnpbegda = gv_begda.
      pnpendda = gv_endda.
    START-OF-SELECTION.
      SELECT sachn
             usrid
        FROM t526 INTO TABLE git_tmadmin
       WHERE sachn NE space
         AND usrid NE space.
      IF sy-subrc EQ 0.
        SORT git_tmadmin BY usrid.
      ENDIF.
    GET pernr.
      rp-provide-from-last p0001 space pn-begda pn-endda.
      IF pnp-sw-found <> 1.
        REJECT.
      ELSE.
        IF p0001-kostl NOT IN s_cctr.
          REJECT.
        ELSE.
          rp-provide-from-last p0007 space pn-begda  pn-endda.
          IF pnp-sw-found = 1.
            MOVE p0007-wostd TO gs_empdtls-wostd.
          ENDIF.
          MOVE :  p0001-pernr TO gs_empdtls-pernr,
                  p0001-kostl TO gs_empdtls-kostl,
                  p0001-ename TO gs_empdtls-ename,
                  p0001-sachz TO gs_empdtls-sachz.
        Employee Position from PA0001
          MOVE: p0001-plans TO gs_empdtls-plans.
          APPEND gs_empdtls TO git_empdtls.
          CLEAR gs_empdtls.
        ENDIF.
      ENDIF.
    Regards
    Mahesh

    What error are you getting?

  • Fixing bluetooth in windows 8.1 and changing the way windows update works

    Hello, this is a message for Microsoft, can you please fix the Bluetooth in the setting in Windows 8.1. Because I can not connect my devices on it to play music. Also, my second suggestion would be for Windows update. First of all,
    Windows tells me that it will install update automatically but It's not true. Everyday I check to see if there is an update on the pc. So change the way windows update works because It is a bit confusing. In other words, try to do like windows 7 if you
    can, or if not It is not a big deal. But a least try to have a solution for this issue and the Bluetooth also. 
    Thank you.
     

    Hi Ariel,
    The MSDN Windows Store apps forums are for developers to discuss writing their own Windows Store apps.
    For help with using Windows please post in the appropriate forum for your OS on
    http://answers.microsoft.com .
    --Rob

  • Daily working hours calculation but Half an hour flexi before start of planned time & shortfall hours calculation

    Dear All,
    I want to calculate daily working hours but Half an hour flexi before start of planned time & shortfall hours calculation if a person didn't completed 9 hours job.
    We have different types of DWS, PWS & WSR for different PS/PSA & EG/ESG groupings.
    We have a requirement for Executives/Officers (E0-E8/ S1-S2) for only one PSA (1100) for only one DWS(GFLX). In this requirement I want to calculate daily working hours but Half an hour flexi before start of planned time & shortfall hours calculation if a person didn't completed 9 hours job.
    Please see the requirement and my configured DWS and PCR's in detail with example and suggest me the solution:-
    Overview
    I want to calculate (Please take the reference from DWS screenshot)
    daily working hours, but starting from first Begin Tolerance Time
    Shortfall of hours if 9 hours not completed, but again starting from first Begin Tolerance Time, although employee has come before Begin Tolerance Time
    I've configured one DWS as below,
    Requirement:-
    The planned shift timings is 9:30 - 18:30. Employees should work and complete 9 hrs in a day, but this 9 hours should be counted only from 9:00 (i.e. Begin tolerance time). It means. In time should not consider before 9:00.
    1. Suppose 1st day employee punch In time is 9:00 then he has to work up to 18:00, then only 9 hours of working will be completed & no shortfall will be calculated.
    In above case, if Out time is 17:00 then shortfall will be calculated 1.0 hours, because his working hours will be counted 8 hrs only.
    2. Suppose 2nd day employee punch In time is 9:45 then he has to work up to 18:45, then only 9 hours of working will be completed & no shortfall will be calculated.
    In above case, if Out time is 18:00 then shortfall will be calculated 0.75 hours, because his working hours will be counted 8.25 hrs only.
    3. Suppose 3rd day employee punch In time is 8:30 then he has to work up to 18:00, then only 9 hours of working will be completed & no shortfall will be calculated. (In between 9:00 - 18:00 ). Here In time is 8:30 but system should consider and count from 9:00.
    In above case, if Out time is 17:30 then shortfall will be calculated 0.5 hours, although he has worked 9 hrs.
    4. Suppose 4th day employee punch In time is 10:11 then he will be marked as Late Come(as per DWS) and then he has to work up to 19:11, then only no shortfall will be calculated, because he completed 9 hours.
    Now the below PCR is calculating Daily Working Hours,
    Now the below PCR is calculating Late Coming Hours,
    Overview
    I know that use of begin tolerance time is different in from my requirement. Please guide me if this DWS configuration will not work.
    As of now system is able to calculate Daily Working Hours (but not from the begin tolerance time), Late coming days and Late coming hours, but shortfall is not getting calculate properly.
    Please give me the idea how to write PCR for these requirement, I know that my ZDHR PCR (Daily Working Hours) needs to change or replace to fulfill this requirements.
    If you want any other details please let me know.
    Best Regards,
    Deepak

    Hi Sankarsan,
    After changing the function PTIP and I used GEN in PAR2, because in PAR3 error was coming.
    After the changes PCR is processing as below for three different IN time :
    1. when IN time is 8:45
    and in this case, ZES table No Time type is showing which is wrong because he worked from 8:45 to 18:30 it means 9:30 hours (calculation should start from 9:00 am).
    2. when IN time is 9:15
    and in this case, ZES table Time type 9002 is showing 9.25 hours which is correct because he worked 9.25 hours.
    3. when IN time is 10:30
    and in this case, ZES table Time type 9003 is showing 9.00 hours which is wrong because he worked only 8 hours.
    Pls suggest.
    Best Regards,
    Deepak

  • Does the 10.0.2 update work?

    Does the 10.0.2 update work?
    I tried the update to 10.0.2 when it was released but the update failed to work.
    Adobe Application Manager gave the following dialogue:
    "Some updates failed to install. Update is not applicable".
    Apple's Get Info for the application says version 1.0.1 and the Adobe about box says version 10.0.1.19
    I ran "updates" from the After Effects help menu again this morning but the response is "no updates available"
    I have the retail copy of CS5 and used the retail version of the update.
    Pip

    Someone's going to say it, so it may as well be me...
    This is a user-to-user group, not an official Adobe technical support outlet.  It is my understanding that Adobe people such as Todd contribute as part of an unofficial help policy, and we all appreciate the input.
    So sorry if you think these very useful fora are shoddy and didn't meet your expectations!

Maybe you are looking for

  • Error while creating a new Dimension/Model in BPC 10.0 NW

    Hello Experts, I am using BPC 10.0 NW system. When I try to create new Dimensions or Models I get the following Error Message. "Error in Admin module or a component used by Admin module. Failed to create SAP NetWeaver BI InfoObject for dimension." I

  • InDesign CS5.5 won't import docx/Word2010 with linked images.

    Hi, Maybe somebody knows what is going out I have WORD 2010 document with LINKED MathType equations saved as EPS files. In WORD 2010 they are LINKED or LINKED AND EMBEDED - but when I try to import this DOCX file into InDesign CS5.5 - images are miss

  • How to setup the Hyperlink from one page to another page

    Hi, I am new to Oracle APEX. My requirement is to setup a Hyperlink from one page to another page. Currently I am displaying 4 columns in the report of Page 1. The report is like below, Survey Response Count_of_Cities City_Name AB Y 2 LONDON,CHICAGO

  • Unable to share from iphoto using Messages....

    I have upgraded to Mavericks and have noticed that I can't share a photo directly from iphoto using Messages. Anyone else have this problem? I got an error message once that said something like "couldn't communicate with helper application". Usually

  • N97 Mini navigation stopped working

    I have N97 Mini (firmware 12.0.110.C01.01), and the navigation used to work very nicely, until recently. Funny thing is that it really gets the GPS lock. The voice guidance gives you the exact instructions where to turn and one of the screens work ok