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

Similar Messages

  • 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

  • Setting a pin code for working hours only?

    Hi, I was wondering if it's possible to set a pin code on my iphone, but one that's just active during working hours? Say 8.30-4.30, and then from 4.30 it comes off. I work in a school and am paranoid about my phone falling into the hands of the kids, but then the pin code really annoys me when I'm at home!
    Cheers

    No, it's not. Apple would need to add a 'profiles' type of feature.
    You can submit feedback to Apple: http://www.apple.com/feedback/iphone.html.

  • 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

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

  • 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

  • Programming for HR  special sheet of working hours

    Sirs!
      Question on programming for HR.
    Through what tables/fields of info-types it is necessary to use
    to contact tables T552A, T550A for formation of the special sheet of working hours.
      I.e. as on PERNR to take data from таbles T552A, T550A, the rest - a trick.
    Yours faithfully
    Al
    e-mail: powgt at rambler.ru

    Hi Varun
    If you have that excessive experiance in ABAP then you wont any difficulty in HR ABAP. All you have to do is to examine the codes in HR ABAP Reports and different applications.
    If you are dealing with Payroll, learn how to read payroll. How to read different clusters of HR. and there are tons of codes available for this. for example I came across few on www.****************.  Moreover learn how to use macros and logical databases. Get yourself acquinted with HR tables.
    As far as BSP is concerned, it will be real handy if you are working on Employee/Manager Self Service.
    - If you compare HR ABAP with ABAP in Logistics then its very different. A different mind set is involved as emphasis shifts on dates and infotypes. The data fetching procedure is different than logistics. Here you use more logical databases and macros than Selects.
    Regards
    Waz
    Edited by: Waz on Dec 18, 2007 10:05 AM

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

  • 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

  • Netherlands Working Hours Formula

    Hi Group,
    I need to overwrite a fast formula for Netherlands. This is what oracle has provided without give any explanation what is the type of the formula where to attach the formula. Please if any one has any input please share. I am stuck with this
    Netherlands Working Hours Formula
    Oracle HRMS enables you to derive the weekly working hours to appear on the Central
    Bureau of Statistics (CBS) file. You define a FastFormula with the name
    NL_WEEKLY_WORKING_HOURS, to return a parameter called Working_Hours with
    a value for weekly working hours in the format 99.99. The formula code uses any
    database items or balances to obtain a value for the weekly working hours.
    Note: If you do not define a FastFormula, the application draws the
    working hours from the Individual Working Hours held on the
    assignment.
    Thanks,
    Nitin Singh

    Hussein,
    I know how to write a formula it is this particular formula i need to overwrite. Oracle has not provide where to attach it or what type of formula is that the only thing which they wrote in the article u have mentioned is
    Netherlands Working Hours Formula
    Oracle HRMS enables you to derive the weekly working hours to appear on the Central
    Bureau of Statistics (CBS) file. You define a FastFormula with the name
    NL_WEEKLY_WORKING_HOURS, to return a parameter called Working_Hours with
    a value for weekly working hours in the format 99.99. The formula code uses any
    database items or balances to obtain a value for the weekly working hours.
    Note: If you do not define a FastFormula, the application draws the
    working hours from the Individual Working Hours held on the
    assignment.
    This is just partial information. What should be the type of formula where it need to be attached. Oracle has not provided with that at all.
    Thanks,
    Nitin Singh

  • Please help me to find simple mathod to get working hours

    Please help me to find simple mathod to get  working hours .The following is my script
    ardate is date argument  in afunction
    id would be integer argument
    Choose  case  dayname(ardate)
      case  'monday'
    select mon_hrs
    into:l_db_hrs from workhrs
    where empid= :id;
      case  'tuesday'
    select tue_hrs
    into:l_db_hrs from workhrs
    where empid= = :id;
      case  'wednesday'
    select wed_hrs
    into:l_db_hrs from workhrs
    where empid= = :id;
     End  Choose
    With Many Thanks
    polachan

    Hi polachan,
    Since this is SQL Server forum, as other post, you need to describe your table structure, the data and expected results. Then it is appropriate and more experts will assist you in there.
    According to your code message, it does not regards SQL Server T-SQL statement. We need to verify if there are two tables (workhrs and I_db_hrs), after checking the values of “ Monday”,”Tuesday”,”Wednesday” from the workhrs table, then copy the related working
    hours into the new table (I_db_hrs),  right?
    If yes, you can refer to the following T-SQL statement.
    create table workhrs
    (id int, workname varchar(20), ardate varchar(10), hrs int)
    insert into workhrs
    values
    (1, 'A','monday',1),
    (1, 'A','tuesday',3),
    (1, 'A','wednesday',5),
    (2, 'B','monday',1),
    (2, 'B','tuesday',1),
    (3, 'C','monday',1),
    (3, 'C','wednesday',2)
    select * from workhrs
    select id, ardate, hrs into I_db_hrs from workhrs
    select * from I_db_hrs order by ardate
    ---the result:
    id ardate hrs
    1 monday 1
    2 monday 1
    3 monday 1
    2 tuesday 1
    1 tuesday 3
    1 wednesday 5
    3 wednesday 2
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

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

  • 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

  • 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

Maybe you are looking for

  • Openzone/Fon doesn't work

    I Have just written to customer care, and will cut and paste here to see if anyone can help. I have enabled BT FOn on my homehib on my pitiful 1,5mb connection in the hope of using openzone and Fon networks when i'm out and about. In fact this is one

  • Want to maintain manual invoice number and amount in SAP

    Hi Experts! Currently I am facing one issue to keep tracking of the manual invoices that were actually submitted to customer. Amount in Manual invoice may be the club of SAP Invoices. To provide customer a error free Statement of Account, we need to

  • Creating a query in a collection - SCCM 2012

    Hi Everyone, I've got a weird issue and was hoping you techies could shed a light. I'm trying to create a script that makes a query into a collection with input from a CSV file. (this is a part of a bigger script, but this is what I'm having trouble

  • IPhone Safari crash when accessing a site.

    I'm developing a iPhone app that there is one module which using the UIWebview to load a web page. The site is : http://answeb.bctechlab.com/c/live.kzemi/main/mobile When the app try to open the link above, the application crashes. I also use the iPh

  • Adobe FlashIslands: Datacommunication and performance

    Hello everybody, We're building a complete frontend in Flash Islands, and at the moment we're working with just data binding. What I know at the moment: - fireEvent to SAP backend and pass along parameter(s) - [Bindable] vars in frontend, and binding