CALCULATE THE NEXT WORKING DATE ACCORDING TO THE CALENDAR

Hello,
Could somebody tell me the name of any function module or abap class to determine the next working day according to calendar. I need add (let say) 30 days to the date but only working days (I dont take into acount sunday, easter etc.)
Thanks in Advance
Adam

try function BKK_ADD_WORKINGDAY
or WDKAL_DATE_ADD_FKDAYS
Cheers
Thomas

Similar Messages

  • Next working date

    HI,
    Can anyone help me with a function to find the next working date excluding holidays from a table 'holidays'
    The input to the function would be a date and output as well.
    Thanks

    Hi,
    Assuming work days are Monday through Friday, and all dts in the holiday table are at midnight:
    FUNCTION  next_work_day (in_dt IN DATE)
    RETURN     DATE
    DETERMINISTIC
    IS
    --  next_work_day returns the frist working day (that is, anything except Saturday, Sunday or days
    --  in the holiday table) after (not including) in_dt.
    --  The value returned is always midnight (00:00:00).
         junk     PLS_INTEGER;
         return_dt     DATE     := TRUNC (in_dt);
    BEGIN
         LOOP
              return_dt := return_dt +
                        CASE     return_dt - TRUNC (return_dt, IW')
                             WHEN  4      THEN  3     -- Friday   -> Monday
                             WHEN  5  THEN  2     -- Saturday -> Monday
                                   ELSE  1
                        END;
              SELECT  1
              INTO     junk
              FROM     holidays
              WHERE     dt = return_dt;
              -- If the SELECT statement above didn't raise an error, this is a holiday,
              -- so repeat the loop and try the next day
         END LOOP;
    EXCEPTION
         WHEN  NO_DATA_FOUND
         THEN
              RETURN  return_dt;
    END     next_work_day;This solution does not depend on NLS settings.
    (Untested.)
    Edited by: Frank Kulash on Jun 4, 2009 3:58 PM

  • How to get the next working date?

    Hi,
    I need to extract data between the 2nd of the month, and second working date of the following month.
    Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays):
    (This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly).
    declare @LatestDate datetime
    set @LatestDate = DATEADD(m,-9,getdate()) -- cast('01/11/2014' as datetime) --dateadd(m,1,datediff(d,0,'01/11/2014'))
    set @LatestDate = DATEADD(d,13,@LatestDate)
    print @LatestDate
    if datepart(dw,@LatestDate) in (1,7)
    Begin
    while datepart(dw,@LatestDate) in (1,7)
    OR
    exists (select * from Hermes_Rep..Holidays where Holiday =right(CONVERT(CHAR(10), @LatestDate, 101),4) + '-' + left(CONVERT(CHAR(15), @LatestDate, 101),2) + '-' + SUBSTRING(CONVERT(CHAR(15), @LatestDate, 101),4,2))
    Begin
    set @LatestDate=DATEADD(d,1,@LatestDate)
    End
    End
    What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table.
    The Holidays table has dates in the format '2014-04-18 00:00:00' (for Good Friday 2014)

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI-ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI-ISO Standard SQL. And you need to read and download the PDF for: 
    https:--www.simple-talk.com-books-sql-books-119-sql-code-smells-
    >>Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays): <<
    Do you know what a calendar table is?
    >> (This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly). <<
    Catholic or Orthodox Easter?  This is one of many reasons we do not use computations in SQL. What you did is the wrong approach  done with bad programming. For example, we do not use the old Sybase getdate() now. The only display format allowed in
    ANSI/ISO Standard SQL, but you used a local dialect! 
    COBOL treats dates as strings like you did; SQL has a temporal data type. 
    >> What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table. <<
    The idea of a Holiday table is bad; why are these dates totally different entities from other dates? Would you split Personnel on sex and have “Male_Personnel” and “Female_Personnel”? 
    The Julian business day is a good trick. Number the days from whenever your calendar starts and repeat a number for a weekend or company holiday.
    CREATE TABLE Calendar
    (cal_date DATE NOT NULL PRIMARY KEY, 
     julian_business_nbr INTEGER NOT NULL, 
    INSERT INTO Calendar 
    VALUES ('2007-04-05', 42), 
     ('2007-04-06', 43), -- good Friday 
     ('2007-04-07', 43), 
     ('2007-04-08', 43), -- Easter Sunday 
     ('2007-04-09', 44), 
     ('2007-04-10', 45); --Tuesday
    To compute the business days from Thursday of this week to next
     Tuesdays:
    SELECT (C2.julian_business_nbr - C1.julian_business_nbr)
      FROM Calendar AS C1, Calendar AS C2
     WHERE C1.cal_date = '2007-04-05',
       AND C2.cal_date = '2007-04-10'; 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Function to calculate how many working date there are.

    Good morning,
    there is a Function/Object to calculate how many working days there are between two dates?
    thanks
    M

    If you have problems finding in the forum the answer to this question, please re-post it and mention how you searched and how the results didn't help.
    Thread locked.
    Rob

  • Code or function to generate next working date for a given date

    hi,
    First lets see the table struncture and table data.
    CREATE TABLE LT_CA_HOLIDAYS
      HOLIDAY_DATE            DATE                  NOT NULL,
      IS_BANK_HOLIDAY         CHAR(1 BYTE)          NOT NULL,
      DISPLAY_NAME            VARCHAR2(35 BYTE)     NOT NULL
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('12/25/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('01/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('01/17/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Martin Luther King Jr');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('02/21/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Washington s B-Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('05/30/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Memorial');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('07/04/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Independence Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('09/05/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Labor Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('10/10/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Columbus Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('11/11/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Verterans Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('11/24/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Thanksgiving Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('12/25/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('12/26/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed Christmas');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('01/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
    Values
       (TO_DATE('01/02/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed New Years Day');
    COMMIT;.
    The requirement goes something like this:
    Weekend days SATURDAY and SUNDAY ARE CONSIDERED holidays.
    The list of holidays are in LT_CA_HOLIDAYS.
    We will be given a date as p_processdate.we need to check if p_processdate is a holiday or a working day,
    if p_processdate is a holiday then we need to generate the next working day .
    If p_processdate is a working day we need to test whether p_processdate +1 is a working day, IF p_processdate+1 is a holiday then
    we need to generate the next working day near to p_processdate + 1.
    Regards

    DECLARE
    day_param date:=TO_DATE('01/16/2011','MM/DD/YYYY');--- SET your input date 
    n_yes number;
    BEGIN
         LOOP
                 day_param:=day_param+1;
                 select count(*) into n_yes from LT_CA_HOLIDAYS WHERE TO_CHAR(HOLIDAY_DATE,'MM/DD/YYYY')=TO_CHAR(day_param ,'MM/DD/YYYY') ANd IS_BANK_HOLIDAY='Y' ;
              IF(to_char (day_param,'DY') NOT IN ('SAT','SUN')) AND n_yes=0 THEN
                   EXIT;
              END IF;
         END LOOP;
         DBMS_output.put_line('output'||day_param);
    END;OUTPUT
    output18-JAN-11
    Edited by: Leonard on Aug 26, 2011 5:13 AM

  • Scheduled delivery date according to customer calendar

    hi all,
    i maintained a customer calendar with only friday as work day, and assigned it to customer in uploading point in customer master data.
    when creating sales order, the system checks the customer calendar with the date proposal from sales order type, and display message "No goods accepted on 2008.11.19. The next possible date is: 2008.11.21". that means customer calendar works, but the system didn't change the date proposal to 1121, and further, it didn't change the schedule line delivery date accordingly. it give and just give a message out.
    i need the system calculate delivery date or schedule line date under the restriction from customer calendar, not just give some message.
    i once make it out that the system automatically changed the schedule line into two line, say, the first line is 0 pc on 1119, and the second line is 10 pc on 1121. but afterwards, i can no longer reproduce the result.
    can anybody give me some help on it? thanks a lot.
    daniel

    Daniel,
    I'm not sure but you may want to try it out. Deselect the Propose Delivery Date option in the Sales Document type and then try. Maybe the system in proposing the date because of this configuration and is not changing as per customer calendar
    Regards
    Nadarajah Pratheb

  • How to get working Date based on factory Calendar and current date

    Hi All,
    I want to deletermine a date which is Invoice date + 3 working days excluding SAT, SUN and holidays. For e.g, if Invoice date is 18th Sept, 2009, then my desired date should 23rd Sept, 2009.
    I do have factory calendar ID but i dont know the proper function module.
    Can some one please help me...

    Hi,
    check this code,
    DATA:
    w_date   TYPE dats,
    w_date1  LIKE scal-date,               " dats
    w_date2  LIKE scal-date,
    i_factid LIKE tkevs-fcalid VALUE 'IN', " IN for India
    it_dats  TYPE TABLE OF rke_dat,
    wa_dats  LIKE LINE OF it_dats,
    w_lines  TYPE i.
    CALL FUNCTION 'CALCULATE_DATE'
      EXPORTING
        days        = '0'
        months      = '1'
        start_date  = sy-datum             " for example '20090918'
      IMPORTING
        result_date = w_date.              " 1 month added '20091018'
    w_date1 = sy-datum.
    w_date2 = w_date.
    CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
      EXPORTING
        i_datab  = w_date1
        i_datbi  = w_date2
        i_factid = i_factid
      TABLES
        eth_dats = it_dats.                " number of working days between two dates
    READ TABLE it_dats INDEX 4 INTO wa_dats.
    WRITE :
      / wa_dats-periodat.                  " new date '20090923'
    Hope this will be helpfull...
    Regards
    Adil

  • Calculate the performance of an activity according to the hours worked

    Hi for all,
    I need to calculate the performance of an activity according to the hours worked by anyone. Someone could tell me how can I do this?
    timetable of staff
    ID  HR1  HR2  HR3  HR4   DAY
    1   492  720  780  1080  Monday
    1   612  720  780  1200  Tuesday
    1   492  720  780  1080  Wednesday
    1   612  720  780  1200  Thursday
    1   492  720  780  1080  Friday
    2   492  720  780  1080  Monday
    3   492  720  780  1080  Saturday
    SQL> Select to_date(to_char(trunc(sysdate) + 492/1440,'dd/mm/yyyy HH24:MI:SS' ), 'dd/mm/yyyy HH24:MI:SS') from dual;
    TO_DATE(TO_CHAR(TRUNC(SYSDATE)
    20/01/2011 08:12:00
    Table Holidays
    ID DATE_HOLIDAY HOLIDAY
    1  01/01/2011   Holiday X
    1  03/15/2011   Holiday Y
    1  07/04/2011   Holiday Z
    2  01/01/2011   Holiday X
    Input Values
    Start Date : 17/01/2011
    Qtd Days   : 0
    Qtd Hours  : 11
    Qtd Minutes: 0
    Result
    18/01/2011 13:24Regards,

    Okay here is my second attempt.
    With schedule_of_work As
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Monday'    Day_of_week from dual union all
         Select 1 ID, 612 HR1, 720 HR2, 780 HR3, 1200 HR4, 'Tuesday'   Day_of_week from dual union all
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Wednesday' Day_of_week from dual union all
         Select 1 ID, 612 HR1, 720 HR2, 780 HR3, 1200 HR4, 'Thursday'  Day_of_week from dual union all
         Select 1 ID, 492 HR1, 720 HR2, 780 HR3, 1080 HR4, 'Friday'    Day_of_week from dual
    ), parameters AS
            /* Creating a single row of input values that can be used multiple times */
            SELECT TO_DATE(:job_start_date,'MM/DD/YYYY HH24:MI')             AS job_start_date
                 , TRUNC(TO_DATE(:job_start_date,'MM/DD/YYYY HH24:MI'),'IW') AS beginning_of_week
                 , NVL(:days,0)
                 + NVL(:hours,0)/24
                 + NVL(:minutes,0)/(60*24)                                   AS job_length
            FROM   dual
    ), holidays AS
            SELECT TO_DATE('01/01/2011','MM/DD/YYYY') AS dt FROM DUAL
    ), date_range AS
            /* Trying to generate a date range that should encompass the maximum date it would take
             * to complete the task. Rough estimate is number of 8 hour work days plus a padding of 10 days.
             * You may want to adjust this to something more suitable for your business or set it to an artificially
             * high value. Be aware of possible performance implicications the higher you set it.
            SELECT TRUNC(job_start_date) + (ROWNUM - 1) AS dts
            FROM   parameters
            CONNECT BY ROWNUM <= TRUNC(job_length*24/8) + 10
    ), schedule_as_dates AS
            SELECT sowo.id
                 , sowo.day_of_week
                 , dara.dts
                 , holi.dt
                 , CASE
                        /* Only perform the effective hours when the day is not a holiday
                        * and it matches a date in the date range. Otherwise set effective hours to midnight
                        * making the running sum below zero.
                      WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR1/(60*24)
                       ELSE dara.dts
                   END                                    AS start1
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR2/(60*24)
                       ELSE dara.dts
                   END                                    AS end1
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR3/(60*24)
                       ELSE dara.dts
                   END                                    AS start2
                 , CASE
                       WHEN sowo.day_of_week IS NOT NULL AND holi.dt IS NULL
                       THEN dara.dts + HR4/(60*24)
                       ELSE dara.dts
                   END                                    AS end2
            FROM      date_range       dara
            LEFT JOIN schedule_of_work sowo PARTITION BY (sowo.id) ON sowo.day_of_week = TO_CHAR(dara.dts,'FMDay','NLS_DATE_LANGUAGE=English')
            LEFT JOIN holidays         holi                        ON holi.dt          = dara.dts
    SELECT
           CASE
           /* This means that we need to go into the second shift (start2-end2) to calculate the end date */
           WHEN  work_remaining > end1 - start1
           THEN  start2 + work_remaining - ( end1 - start1 )
           /* This means we can complete the work in the first shift */
           WHEN  work_remaining < end1 - start1
           THEN  start1 + work_remaining
           END   AS finish_time
    FROM
            SELECT b.*
                 /* Determine how much work is remaining from the previous days value */
                 , job_length - prev_work_time                               AS work_remaining
                 /* Calculate the smallest delta value to pick the right day of the week
                    to calculate the end date
                 , ROW_NUMBER() OVER (partition by B.ID ORDER BY DELTA desc) AS RN
            FROM
                    SELECT a.*
                         /* This computation is used to determine which day of the week we need to use
                            to determine the end date of the task
                         , job_length - effective_work_time AS delta
                         /* retrieve the previous effective_work_time. This will be used above */
                         , LAG(effective_work_time) OVER (PARTITION BY ID order by start1) AS prev_work_time
                    FROM
                            SELECT job_start_date
                                 , job_length
                                 , id
                                 , day_of_week
                                 , start1
                                 , end1
                                 , start2
                                 , end2
                                  /* Compute the amount of time an employee can work in any given day. Then take a running total of this */
                                 , SUM
                                     CASE
                                         /* When the job_start_date is the same day as the first eligible work day we need to diskount (spam filter misspelled on purpose the
                                          * effective work hours because the job could start in the middle of the day.
                                         WHEN TRUNC(job_start_date) = TRUNC(start1)
                                         THEN
                                              CASE
                                                   WHEN job_start_date BETWEEN start1 AND end1
                                                   THEN (end1 - job_start_date) + (end2 - start2)
                                                   WHEN job_start_date BETWEEN start2 AND end2
                                                   THEN (end2 - job_start_date)
                                                   WHEN job_start_date < start1
                                                   THEN (end2 - start2) + (end1 - start1)
                                                   WHEN job_start_date > end2
                                                   THEN 0
                                              END
                                         ELSE (end2 - start2) + (end1 - start1)
                                     END
                                 ) OVER (PARTITION BY ID order by start1) AS effective_work_time
                            FROM       schedule_as_dates
                            CROSS JOIN parameters
                    ) a
            ) b
            /* Only interested in delta less than zero because the positive deltas indicate more work needs to be done. */
            WHERE delta < 0
    WHERE RN = 1I got slightly different results then you. My query got me 1/24/2011 at 13:12. I double checked the math and I think that's right.
    Hopefully this works out for you. My apologies for any mistakes.
    EDIT
    Query is fully posted now.

  • Calculate the working days having the start and end dates only

    Hi,
    Can BIP be able to calculate the working days having the start and end dates only? It is like the NETWORKDAYS function in Excel. (i.e. excluding weekends and holidays).
    Thanks.

    Not out of the box.
    But You could extend your BIP functions
    Look at here:
    http://blogs.oracle.com/xmlpublisher/2009/05/bip_by_extension.html
    Based on that what you need is similar to the following Java code:
    http://objectlabkit.sourceforge.net/
    regards
    Jorge A.

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • How to calculate the next incoming PO for a given material/plant in an elegant way

    Hi experts,
    Given a material and a plant i want to find out when the next PO is arriving. Is there a function module to calculate it?
    This is the values i want to retrieve, but this method is not very optimized and can have performance issues:
    "Entry un EKPO with material (MATNR), plant (WERKS), and Delivery Completed Indicator (ELIKZ) = blank, select the PO
    numbers.
    For all the POs, sort in EKET for the field ‘Delivery Date’ (EINDT) to get the next delivery date being
    EINDT ≥ Todays day
    Take the next PO to be received. Do the calculation (MENGE – WEMNG) for the item
    The result of the calculation is the amount still open and that is supposed to be received. "

    Hi,
       You can use the FM: MD_STOCK_REQUIREMENTS_LIST_API. Execute the FM with plant and material number in selection. Now, check the structure: MDEZX which will give you all the requirements for the item. You can filter the items in the structure where MDEZX - DE = BE which will give you only the purchase orders. Also, the items will be sorted automatically based on the date.
        Please check the same and revert back.
    Regards,
    AKPT

  • How to calculate the duration/age of a work request.

    I need to calculate the actual resolution time in 'Days:Hours:Minutes' format, for the work requests which are being worked upon by the engineers working in my team. I am using MS-Excel (MS-Office 2013) for reporting. The tool from which I am exporting
    the details shows the Open and Resolved time as MM/DD/YYYY HH:MM:SS (3/20/2015 10:32:16 AM). I am sure this is one of the thing which is not that difficult and many reporting people are doing this. Thanks in advance for the assistance.
    Regards, Ankit Arora

    Let's say that the Open date/time is in A2 and the Resolved date/time in B2.
    The formula for the resolution time is =B2-A2
    Format the cell with the formula with the custom number format d:hh:mm
    This will work as long as the number of days is at most 31.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • How to calculate the number of days worked for a given period

    I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
    Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
    The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
    Can this be done and if so, do you have any suggestions as to how to do it?
    Thanks.

    hi
    So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
    Your code in the reporting exit should look like that.
    bye
    data : wa_employee type /bi0/pemployee.
    When 'ZDATE1'
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
    clear l_s_range.
    clear wa_employee
    1- select the entries from table employees
    select single employee dateto datefrom
    from /bi0/pemployee
    into corresponding fields of wa_employee
    where dateto le loc_var_range-low
    and datefrom ge loc_var_range-high.
    if sy-subrc eq 0.
    CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
       EXPORTING
           i_datum_von  = wa_employee-datefrom
           i_kz_ult_von = 'X'
           i_datum_bis  = wa_employee-dateto
           i_kz_ult_bis = 'X'
           i_szbmeth    = '1'
       IMPORTING
          e_tage       = no_days.
           l_s_range-low  = no_days.
           l_s_range-sign = 'I'.
           l_s_range-opt  = 'EQ'.
          APPEND l_s_range TO e_t_range.
              ENDIF.
            ENDIF.
    endloop.
    ENDIF.
    Boujema

  • Next inspection date is not updated in batch / prposed at the time of UD

    Hi
    I have configurted the system for retest of batches, the system successfully creates the inspection lot but when does not propose next inspection date at the time of UD nor it updates in Batch Master.
    I entered inspection interval days in QM View, the system entered the first inspection date correctly. Also Batch Restriction is working properly.
    Kindly help.
    regards
    Mobashir

    Hi Shaymal & VRMP
    I have checked the system, the only problem I am facing is that the system does not show next inspection date dialog box at the time of UD where I can see the next inspection date being set by the system
    Say, I use QA07 (Triggered Manually) on 19.jan.08. The Next inspection date was 26.jan.08 and Initial Run in Days was 10 (days), the system created inspection lot on 19.jan.08 successfully. At the time of UD it automatically set 29.jan.08 as the next inspection date (i.e. 19.jan.08 + 10 days)  istead of 06. Feb.08 (i.e. 26.jan.08 + 10 days) without showing dialog box / suggesting next inspectino date. 
    regards
    Mobashir
    Edited by: Muhammad Mobashir on Jan 19, 2009 7:11 AM

  • How to set start of cycle/next planned date at the Maintenance Item level??

    Hi All,
    We are uploading a bulk of Strategy Maintenance Plans into the system. Each plan has multiple maintenance items and each maintenance item in a plan having different next due dates. Now if we set the Start of cycle at the Maintenance Plan level, then the next due dates of the maintenance items in that plan would be calculated on the basis on Start of Cycle (Common for all) and frequency as set in MPackages in an item Task list. Since each Maintenance item may have different Frequency and next due date, generating a call object while scheduling the plan correctly to satisfy at the Maintenance item level is not seeming possible.
    Can someone please suggest as to how do I set the Start of cycle or say Next Planned Date or Last Scheduled date at the Maintenance Item level either through configuration or programmatically.We are working on an SAP 4.6C version.It is urgent!!!

    hi
    i think specifying start of the cycle for each maintenance level is not possible ,since start of the cycle refers to maintenance plan only .
    for SAP standard kindly refer the following [link|http://help.sap.com/saphelp_46c/helpdata/en/94/43a968abc011d395bd00a0c93029cf/content.htm]
    it is better to create one maintenance item per maintenance plan,if you want to control each maintenance item independently
    regards
    thyagarajan

Maybe you are looking for

  • How do i get an animated wallpaper on my iphone 4

    I have an iPhone 4 and I really want an animated background on my homescreen, not my lock screen, but I don't want to jail break my phone. Does anyone know how to do it?

  • Count the number of rows

    I have a JSP page that access to a JAVA class, where I connect with the MySQL data base, and where I make some consults. Hi, I need to knows how many rows I get from a SELECT consult. I have this class to do: package connectDB; import java.lang.*; im

  • Adobe on iSeries

    Hello Gurus, i'm right now installing  a NW 7.3 Java with the Adobe Usage type. Does any of you have a "post Configuration/Processing manual" that I can follow to configure Adobe ? One litle more question, in the old Adobe that I've (Double Stack Aba

  • I have a programming problem

    Please post code that solves it. kthx ~~ :-*

  • Why does my music sound weird in iTunes?

    When I play music. it sounds like a fan is running over the speakers. It sounds rubbish. But this is only in iTunes. When I play through Quick Time it sounds absolutly fine. I am running Mountain Lion and have updated iTunes and it still happens. PLE