Calculating worked hours

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

Similar Messages

  • Calculating working hours

    Hello,
    I am using the below sql query to calculate working hours. The problem which i am facing is that query is taking lot of time to calculate the working hours. Please help to reduce the execution time of this query or if there is any other way to calculate working hours
    The following query take 63.499 sec
    SELECT sql_calc_found_rows                                          gstime,
           MAX(stoptime)                                                AS mx,
           MIN(starttime)                                               AS mn,
           Sec_to_time(SUM(Time_to_sec(Timediff(stoptime, starttime)))) AS totalworktime
    FROM   (SELECT gstime,
                   gstime                                               AS stoptime,
                   Coalesce((SELECT MAX(b.gstime)
                             FROM   xydata b
                             WHERE  objectid = '17'
                                    AND clientid = '1'
                                    AND gstime > '2010-04-20 08:22:27'
                                    AND gstime < '2010-04-26 10:22:27'
                                    AND b.objectid = a.objectid
                                    AND b.gstime < a.gstime), gstime) AS starttime
            FROM   xydata a
                   INNER JOIN fm4features f
                     ON f.id = a.id
            WHERE  objectid = '17'
                   AND clientid = '1'
                   AND gstime > '2010-04-20 08:22:27'
                   AND gstime < '2010-04-26 10:22:27'
                   AND f.dataid = '1'
                   AND f.VALUE = '1') derived
    GROUP  BY Date_format(gstime, '%Y-%m-%d')
    ORDER  BY gstime ASCplease help me how do i change the query to reduce the sec.
    Bakthavachalam E

    I post explain output here
    explain extended ouput
    1     PRIMARY     <derived2>     ALL                         2749     100     Using temporary; Using filesort
    2     DERIVED     a     range     PRIMARY,id_objid     id_objid     16          33359     100     Using where; Using index
    2     DERIVED     f     ref     ID     ID     4     navl.a.ID     3     100     Using where
    3     DEPENDENT SUBQUERY     b     range     id_objid     id_objid     16          33359     100     Using where; Using indexxydata and Fm4features show create table
    xydata     CREATE TABLE `xydata` (
      `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `Longi` varchar(255) DEFAULT NULL,
      `Lat` varchar(255) DEFAULT NULL,
      `Altitude` int(11) NOT NULL,
      `Angle` int(11) NOT NULL,
      `Satellite` int(11) NOT NULL,
      `Speed` int(11) NOT NULL,
      `ObjectId` int(10) unsigned NOT NULL,
      `ClientId` int(10) unsigned NOT NULL,
      `GpsTime` datetime NOT NULL,
      `Location` varchar(255) DEFAULT NULL,
      `City` varchar(255) DEFAULT NULL,
      `State` varchar(255) DEFAULT NULL,
      `Distance` varchar(100) DEFAULT NULL,
      `Times` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      PRIMARY KEY (`ID`),
      KEY `id_objid` (`ObjectId`,`ClientId`,`GpsTime`) USING BTREE
    ) ENGINE=InnoDB AUTO_INCREMENT=70288 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSEDand
    Fm4features show create table
    fm4features     CREATE TABLE `fm4features` (
      `ID` int(10) unsigned NOT NULL DEFAULT '0',
      `DataId` int(11) NOT NULL,
      `Value` varchar(20) NOT NULL,
      KEY `ID` (`ID`),
      CONSTRAINT `new_xydata_id` FOREIGN KEY (`ID`) REFERENCES `xydata` (`ID`) ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSEDPlease any one help how to reduce the execution time.
    Edited by: user13055307 on May 1, 2010 12:38 AM
    Edited by: user13055307 on May 1, 2010 12:45 AM
    Edited by: user13055307 on May 1, 2010 12:46 AM

  • Calculating working hours to hibernate query

    Hello,
    How to i convert this into Hibernate Nativesql query
    SELECT sql_calc_found_rows                                          gstime,
           MAX(stoptime)                                                AS mx,
           MIN(starttime)                                               AS mn,
           Sec_to_time(SUM(Time_to_sec(Timediff(stoptime, starttime)))) AS totalworktime
    FROM   (SELECT gstime,
                   gstime                                               AS stoptime,
                   Coalesce((SELECT MAX(b.gstime)
                             FROM   xydata b
                             WHERE  objectid = '17'
                                    AND clientid = '1'
                                    AND gstime > '2010-04-20 08:22:27'
                                    AND gstime < '2010-04-26 10:22:27'
                                    AND b.objectid = a.objectid
                                    AND b.gstime < a.gstime), gstime) AS starttime
            FROM   xydata a
                   INNER JOIN fm4features f
                     ON f.id = a.id
            WHERE  objectid = '17'
                   AND clientid = '1'
                   AND gstime > '2010-04-20 08:22:27'
                   AND gstime < '2010-04-26 10:22:27'
                   AND f.dataid = '1'
                   AND f.VALUE = '1') derived
    GROUP  BY Date_format(gstime, '%Y-%m-%d')
    ORDER  BY gstime ASCanybody having idea please help me
    Bakthavachalam E
    Edited by: user13055307 on Apr 29, 2010 2:57 AM

    Hello,
    How to i convert this into Hibernate Nativesql query
    SELECT sql_calc_found_rows                                          gstime,
           MAX(stoptime)                                                AS mx,
           MIN(starttime)                                               AS mn,
           Sec_to_time(SUM(Time_to_sec(Timediff(stoptime, starttime)))) AS totalworktime
    FROM   (SELECT gstime,
                   gstime                                               AS stoptime,
                   Coalesce((SELECT MAX(b.gstime)
                             FROM   xydata b
                             WHERE  objectid = '17'
                                    AND clientid = '1'
                                    AND gstime > '2010-04-20 08:22:27'
                                    AND gstime < '2010-04-26 10:22:27'
                                    AND b.objectid = a.objectid
                                    AND b.gstime < a.gstime), gstime) AS starttime
            FROM   xydata a
                   INNER JOIN fm4features f
                     ON f.id = a.id
            WHERE  objectid = '17'
                   AND clientid = '1'
                   AND gstime > '2010-04-20 08:22:27'
                   AND gstime < '2010-04-26 10:22:27'
                   AND f.dataid = '1'
                   AND f.VALUE = '1') derived
    GROUP  BY Date_format(gstime, '%Y-%m-%d')
    ORDER  BY gstime ASCanybody having idea please help me
    Bakthavachalam E
    Edited by: user13055307 on Apr 29, 2010 2:57 AM

  • 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

  • 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?

  • 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

  • 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 S

    Hi,
    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

  • 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

  • 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

  • Calculate Date/Time Difference in a Calculated Column Omitting Weekends, Holidays and Non-Working Hours

    I am looking for a formula to use in a calculated column that calculates the difference between two date/time fields while excluding weekends, holidays and non-working hours
    6/1/2010 9:43 AM - 6/7/2010 1:45 PM
    Here is the closest that I have gotten; however, this formula gives me a result of 96:
    =IF(AND((WEEKDAY([Resolved Date],2))<(WEEKDAY(Created,2)),((WEEKDAY(Created,2))-(WEEKDAY([Resolved Date],2)))>1),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved Date],"D")+1)/7,1))-3),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved
    Date],"D")+1)/7,1)*2))*24)
    Any and all assistance is greatly appreciated!

    I don't know how to exclude holidays but i exclude weekends(Sat&Sun)-
    IF(ISERROR(DATEDIF([Start Date],[End Date],”d”)),””,(DATEDIF([Start Date],[End Date],”d”))+1-INT(DATEDIF([Start Date],[End Date],”d”)/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start
    Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End
    Date])=7),1,0))
    -Thanks
    Swapnil

  • 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 Kesavan

    This might be better answered on the Human Capital Management (HCM) (MOSC) forum.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • 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

  • 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
    MPersson

    Rob,
    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

  • Allowance calculation based on Planned & Actual working hours

    Hi,
    Please advise how to calculate an allowance based on employees Planned working hours & Actual working hours for a particular work schedule rules.
    Example A – Employee on Work Schedule for the Whole Month Employee has a 0007 infotype record that has them on Work Schedule SC112 for the whole of April 2008. System pays 100% of the allocated payment of $166.67 per month
    Example B – Employee on Work Schedule for part of the Month, Employee has a 0007 infotype record that has them on Work Schedule SC112 for the part of April 2008 as they only started on 14th April 2008. Planned Hours for April for SC112 are 180 hours and this person has worked 108 hours which is 60% (=108/180). System should pay 60% of the allocated payment of $166.67 per month which results in a payment of $100.00 for the employee.
    Your help would be really appreciated.
    Regards
    Ranjith Yama

    Hi Manoj,
    Suppose ABCD is the wagetype for xyz allowance. I hope you are getting this 1000 amount from T510.
    This is the logic of PCR for your requirement.
    ABCD
      NUM=TKAU**        --> Getting Unpaid Absences (Suppose 2)
      RTE=KCONS2        --> Maintain CONS2 constant in T511K Table with 200
      MULTI NRA            --> Multiplying No.of Absences with 200.. that is 400
      ADDWT &BUFF     --> Saving that in one Variable
      FILFF NRA            --> Restoring Actual values
      AMT- &BUFF        --> Subtracting from 1000 and you will get the 600
      AMT?0
         ADDWT *
       <              
         AMT=0             --> if amount is less than 0 then amount will bocome 0
    Hope this helps.
    Pradeep.

  • Worked hours code

    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 against another table to figure out if the employee depends to a particular region 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?

    Sorry. here the Post again (complete )
    Hi Raj Coppar,
    try this code:
    this should be implemented in the End-Routine if you're working with BI 7.0.
    first you need to define the internal tables that have same structure as table where comparing information is stored.
    Code:
    Data: it_table TYPE TABLE OF /n42/YOURTABLE,
             li_table  LIKE LINE OF it_table.
    DATA:
               KALENDER      LIKE SCAL-FCALID,
               with_ATTRIBUTE LIKE SCAL-INDICATOR,
               lc_holiday_found    LIKE SCAL-INDICATOR.
    DATA: BEGIN OF FEIERTAGE OCCURS 5.
                INCLUDE STRUCTURE THOL.
              DATA: END OF FEIERTAGE.
    *Store needed information for comparison
    select * from /n42/YOURTABLE into table it_table.
    sort it_table by /n42/employeeID.
    Loop in the Data_PAckage
    LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
    *Check if Date is a Holiday
          CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
               EXPORTING  DATE                 = <source_fields>-Date.
                           HOLIDAY_CALENDAR_ID  = KALENDER
               IMPORTING  HOLIDAY_FOUND        = lc_holiday_found
               TABLES     HOLIDAY_ATTRIBUTES   = FEIERTAGE
               EXCEPTIONS HOLIDAY_CALENDAR_ID_MISSING       = 1
                            DATE_AFTER_RANGE                  = 2
                           DATE_BEFORE_RANGE                 = 3
                           DATE_INVALID                       = 4
                           HOLIDAY_CALENDAR_NOT_FOUND        = 5.
    *read internal table and make your checks
    READ TABLE it_table BINARY SEARCH INTO  li_table
          WITH KEY /n42/employeeID = <source_fields>-/n42/employeeID.
    if record was found.
          IF sy-subrc EQ 0.
    *if region is.....
             if li_table-/n42/REGION = "Whatever" and
    *Date is a Public Holiday
             lc_holiday_found = 'X' .
    *Claculate Overtime
                 if <source_fields>-Hours > 8.
    *write overtime to Overtime Field
                  <source_fields>-overtime = <source_fields>-Hours - 8.
                 endif.
          ENDIF.
    modify Result_Package.
    endloop.
    hope this helps.
    BR,
    Younes

Maybe you are looking for