Calculating total working hours
Hai Experts ,
i want to calculate the total working hours of every employee.
my scenario is .. i am having a table zworkinghours
the fields are
SNO -numc
EMPID-int4--- employee id
DATEE-dats--- date
WHOURS-tims--- hours worked
sample datas:
(PK)SNO EMPID DATEE WHOURS
01 101 2008/01/12 11:12:20
02 102 2008/05/14 12:12:45
03 103 2008/06/24 07:45:56
04 101 2008/04/13 12:12:20
05 102 2008/07/21 15:12:45
06 103 2008/04/25 03:45:56
now i want to calculate the total working hours of a every employee
the output needed is
EMPID(101) TOTAL WORKING HOURS(11:12:45 + 12:12:45)
101 23:25:40
plz help with the code ..
thanks and kind regards
Hi,
Slight change in your code will work. Remember that the Headerline gets cleared inside at AT....ENDAT processing Block. You need to use an explicit workarea to take care of this.
See the BOld Code with the Changes...
Data wa like line of itab.
loop at itab .
Clear wa.
Move itab to wa.at new empid.
write :/ 'Employee Id ',wa-empid.
uline.
sum.
endat.
write :/ 'date' , itab-datee,
'time worked',itab-whours.
itab-total = 0.
itab-total = itab-total + itab-whours.
Clear wa.
Move itab to wa.
at end of empid.
uline.
write : / 'total working hours ', wa-total .
skip.
endat.
ENDLOOP.
This should solve your problem
Edited by: AJAY TIWARI on Nov 9, 2008 9:02 AM
Similar Messages
-
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
MaheshWhat error are you getting?
-
Need total worked hours of each employee
Hi all
I need the total work hour for each employee
create table pde(empno number(10),act_hour varchar(10 byte));
Table created
insert into pde values(211,'12:20');
insert into pde values(211,'06:00');
insert into pde values(213,'07:00');
insert into pde values(213,'07:20');
WITH got_total_hours AS
SELECT SUM ( TO_NUMBER (SUBSTR (act_hour, 1, 2))
+ ( TO_NUMBER (SUBSTR (act_hour, 4, 2))
/ 60
) AS total_hours
from pde
SELECT TO_CHAR (FLOOR (total_hours))
|| ':'
|| TO_CHAR ( MOD (total_hours, 1) * 60
, 'fm00'
) AS hh_mm,empno,act_hour
FROM got_total_hours ,pde
this is the output i am getting
HH_MM EMPNO ACT_HOUR
32:40 211 12:20
32:40 211 06:00
32:40 213 07:00
32:40 213 07:20
i require HH:MM EMPNO ACT_HOUR
18:20 211 12:20
18:20 211 06:00
14:20 213 07:00
14:20 213 07:20
kindly help meThanking in advance
regards,
oracleuserHi Ravi,
Your solution works perfectly fine but there is a prob when i incorporate ur solution in the main query
WITH temp AS
(SELECT employee_number,
act_hour ,
SUM(to_number(regexp_substr(act_hour,'[^:]+',1,1))*60+to_number(regexp_substr(act_hour,'[^:]+',1,2))) over (partition BY employee_number) tot
FROM nap_PUNCH_DATA_EMP_LIST trn where DATE_ENTRAY between '23-Aug-2009' and '24-Aug-2009'
SELECT employee_number,act_hour,ROUND(tot/60)||':'||mod(tot,60) tothours FROM temp
o/p i am getting is
EMPLOYEE_NUMBER ACT_HOUR TOTHOURS
408 06:31 07:31
408 00:00 07:31
410 18:12 30:59 ------SUM of 18:12 and 11:47 should be 29:59
410 11:47 30:59
this is working correctly for majority of employee_numbers with exception of some employee_numberskindly help
regards,
oracle user
Edited by: makdutakdu on Jan 4, 2010 12:45 PM -
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 -
Calculating Standard working hours based on location/department
Hi Experts,
In Fusion HCM 8.0
Is there any way to calculate the Standard working hours based on location/department and FLSA code?
For new hires, can this be populated based on above criteria?
Please let me know how to proceed on this.
Thanks in advance.
Thanks&Regards
Prasanna KesavanThis might be better answered on the Human Capital Management (HCM) (MOSC) forum.
Jani Rautiainen
Fusion Applications Developer Relations
https://blogs.oracle.com/fadevrel/ -
How to Calculate Total Worked Hours in a date range
<p><span>WorkedHours column type is varchar(8) (for HH:MM:SS), <br />how to sum working hours of an employee for every month.</span> <br /></p><p><span>ex. of data : WorkedHours<br /><br />attencode attendate WorkedHours<br />1573 20-01-2007 07:34:22<br />1573 21-01-2007 12:31:10<br /><br />how can i sum the WorkedHours and print it in Hours format.<br />(like 20.17 for this 2 values)<br /><br />Can u able to follow me.<br />If not pls. feel free to get more information in this regard.</span></p>
Create a formula like this :
((hour({tmpDate.attendate }) * 60 * 60) +
(minute({tmpDate.attendate }) * 60) +
Second({tmpDate.attendate }))/3600
and then take the Sum of it. You can get the result.
logic behind this is all the hours and minutes are converted into seconds and then added and divided by 3600 to get the actual hours.
thanks
kanak -
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,
DeepakHi 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 -
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 scriptFixed 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 ); -
Project server 2013 how to check work hours per hour per project
Hi all,
I would like to know how to check the total work hours for a project per month. For examples, I want to know all the work hours for all resources spent for the project A in August. Any idea?
Thanks,
AnnaHi Anna,
If you don't want to write queries, I'd suggest you to simply open the project unchecking the option "load resources summary assignments" and go to the task usage view. Then display the project summary task and choose the monthly timeframe ("view"
tab) for the timephased part of the screen (right part).
Hope this helps,
Guillaume Rouyre, MBA, MCP, MCTS | -
Code for employee worked hours calculation
Hello everyone,
I need some help with an ABAP code:
I have records coming in with Employee ID, Date and Worked hours along with some other fields.
I need to look up the employee id aginst another table to figure out if the employee depends to a particular state or not and the date is holiday or not from different table.
Also I would like to see if worked hours are more than 8 and put the extra hours into a differemt field for calculating if the total hours in a week exceed 40.
Can you please help with this code?
Thanks,
Raj>
Raj Coppar wrote:
> Hello everyone,
>
> I need some help with an ABAP code:
>
> I have records coming in with Employee ID, Date and Worked hours along with some other fields.
>
> I need to look up the employee id aginst another table to figure out if the employee depends to a particular state or not and the date is holiday or not from different table--- u can use FM BKK_CHECK_HOLIDAY to find out the given date is holiday or not ? Also I would like to see if worked hours are more than 8 and put the extra hours into a differemt field for calculating if the total hours in a week exceed 40.
>
> Can you please help with this code?
>
> Thanks,
> Raj -
Hey guys, I'm sorry if this has been asked a million times, but I can't seem to find the exact answer by searching.
I want to use numbers '09 to calculate the hours I've worked, preferably each week. However, I'd like this list to continue over time, rather than making a new table every week, IE I can see what days I worked 3 months ago and how many hours I did.
What I want to have is a chart, in which I can insert my clock in and clock out times, and after every 7th day it will give me a total of my worked hours.
Here is a screenshot of a layout I'd like, however I'm open to better suggestions! It's all just typed in, but I'd like it to be auto complete of course.
http://img512.imageshack.us/img512/7370/screenshot20091129at230.png
Is this possible? In the future I'd like it to be able to calculate my pay aswell, maybe with a forumla to minus the 1 hour of lunch inbetween my clock in and clock out, however this could wait as I'm very new to this program.
All help is GREATLY appreciated,
Thanks, Lewis.Hi Lewis,
The first three columns must contain data recognized by Numbers as Date and Time information.
I would skip the empty spaces in the date list. Enter the first date in A2 and use the Cell (format) Instpector to set the date format to match your example.
Then click on A2, grab the small round handle at the bottom right of the cell and drag down to fill in the rest of the dates.
The Duration column (D) could contain a simple formula:
=Clock out 'Sun, Nov 29, 2009'-Clock in 'Sun, Nov 29, 2009'
But in that form it will generate an error message in the weekly sum for any week in which you didn't work (or at least record an in and out time) on every day. To avoid that, use the formula below:
=IF(ISBLANK(Clock out 'Sun, Nov 29, 2009'),"",Clock out 'Sun, Nov 29, 2009'-Clock in 'Sun, Nov 29, 2009')
+Note: Construct the formula using the Function Browser to insert the functions. Click on the cells whose values are to be used. The labels above are those that were generated as I constructed the formulas; typing them in may not work in your table.+
Fill down column D by dragging the handle as above.
+With the data in your sample table, you will get a "-10h 0m" result in D2 as all times in this row are recorded as being on November 29, 2009. Quit before midnight. (Or adjust your start and stop times to both fall on the same day.)+
E8 (and every seventh cell in E after than) will use the
SUM function to add the times for the past seven days.
=SUM(D2:D8)
To Fill down column E, select the seven cells E2:E8, then grab and drag the handle down the column.
You should get mostly empty cells, with a number or a duration appearing in every seventh row.
Regards,
Barry -
Daily working Hours Calculation
Dear All
Time Management - >Work Schedules->Set Work Schedule rules and work schedule
How to calculate the Daily working hours if my shift time is as given below
Night 00:25 to Morning 07:30
My break time is between 3:30 to 4:00
So my actual working hours is 6:35 hours (6 hrs and 35 min).
What i need to enter in the Daily working hours, whether 6.35 or 6.58 (0.25/15*35)?
regards
Suresh SHi,
First create a break shedule from 3:30 to 4:00 AM and specify if paid or unpaid.
Use this break schedule while creating daily work schedule. Specify the timings of 0:25 as start in planned working time, the end time will be calculated automatically.
Use this DWS in your PWS which you in turn use while setting WSR as you stated above. The Daily Working time will be automatically taken from DWS. And I think it should be 6:35 hrs.
cheers
Ajay -
Work Hours Calculation - ERROR
Hi All,
I'm having difficulty with the Work Hours Calculation in Project. It seems that when the number of hours within a subtask group exceeds 1000 hours, the display returns 1 hour. Whilst the Project Statistics for cost are correct, the number of hours is wrong!
Has anyone seen this error before and can help?
I would post piccy but Microsoft wont allow that yet.Thanks for the reply Guillaume,
The Project version in question is 2007 SP3.
The issue occurs on every project that I am currently handling so it is causing me some troubles at the moment. I have even tried using the example you gave and it still does not work correctly.
Unfortunately until my account is approved I cannot post pictures however the following is the equivalent to your project above:
Project 1 67 days
Mon 15/12/14 Tue 17/03/15
1 hrs
Summary
67 days Mon 15/12/14
Tue 17/03/15 1 hrs
A 50 days
Mon 15/12/14 Fri 20/02/15
400 hrs A
B 67 days
Mon 15/12/14 Tue 17/03/15
536 hrs B
C 30 days
Mon 15/12/14 Fri 23/01/15
240 hrs C
D 10 days
Mon 15/12/14 Fri 26/12/14
80 hrs D
Many thanks,
Jon -
Hi All,
I need to find out the total man hours worked in a timeline in Plant Maintenance. Can some one please let me know as to how we can do this?
Thanks in advance for your help,
Kanthi.Greetings Kanthi,
IW47 will give you the hours of actual work that have been Confirmed against PM orders
Or if you have a process where you don't confirm hours manually, try Planned hours for Operations in IW37N
Also http://forums.sdn.sap.com/thread.jspa?threadID=2014538&tstart=0 -
Working Hours Calculation possible ?
Anyone know if there is a FM to calculate the Working Hours that exist between two dates.
For instance ...entire year may = 2080 working hours. User wants to know Working hours between
any two dates .... like.... July 1, 2007 and May 5, 2008.....
Thanks
MPerssonRob,
Thats a valid point. In my case I am only determining the total possible working hours for a budget report.
Prior to this, the supervisors were simply using a full year of 52 weeks x 40 hrs = 2080. This report takes
the hours captured on the CATS timesheet and processes them accordingly. So Holidays and any leave
time is identified within the program code and handled then.
Thanks
MPersson
Maybe you are looking for
-
Receiving calls while in text screen
I have a Curve, and if I am reading or writing a text in SMS the phone will not ring to notify me of a call, nor will it indicate "missed call." If I am reading or composing an email, an incoming call interrrupts and I can choose either answer or ig
-
Solaris 10u6 fresh install - can't get Solaris Management Console working
Hey guys, I have been searching all over but can't seem to find any help on getting SMC working. I have a fresh install of Solaris 10u6 on a Sun Fire V20z. So I login via ssh to the solaris machine ("unknown"), and It looks like wbem is online: root@
-
I keep receiving an error message when I try to send an adobe document through Outlook email.
I keep receiving an error message when I try to send an adobe document through Outlook email. The message is : Either there is not default mail client or the current mail client cannot fulfill the message request. Please run Microsoft Outlook and set
-
How to get historical currency rate for second group currency transactions in Fixed Assets
Hello, My client had MXN (Mexico Currency) as a legal currency and when the company code was implemented (went live) group currency was not implemented. After 3 years this company code implemented second local currency as USD and is now a USD functio
-
Copy-Pasting images to change icons of files/folders.
I have changed a few folders to images I have found online, rather than the default blue folder, however there is always a background (usually black). Is there some site that has lots of icons with no backgrounds (for example most applications have n