Duration between working days

Hi !
Need your help on this one,
I need to calculate the duration since the opening ticket until currentDateTime but considering the service hour ex:
Service hours is sunday to saturday from 8h00 to 21h00 so 46800 sec per working days
Ticket opening is from 2012-02-03 09:00:00 to currentdatetime (ex:11h), = 2days,6hours,0min,0sec
I will appreciate if someone can help me on this one, I 've already spent a lot of time on this one,but now i'm a little confused
Thanks in advance

Hi Diane,
Create 2 formula as below:
Formula1: Exact Date:
if ctime({Sheet1_.Date})>Ctime(21,0,0) then cdate({Sheet1_.Date})+1&' '&Ctime(8,0,0) else totext({Sheet1_.Date})
Where in {Sheet1.Date} can be replaced by your date field.
Formula2: Date Diff:
WhilePrintingRecords;
numbervar tot_days_to_sec;
numbervar tot_time_to_sec;
numbervar tot_sec;
//Converts Date Field to Seconds
tot_days_to_sec := floor(CurrentDateTime-DateTime (Date({@Exact Date}),Time({@Exact Date}))) * 46800;
//Converts Time Field to Seconds
tot_time_to_sec := CurrentTime -time({@Exact Date});
//Adds total seconds
tot_sec := tot_days_to_sec + tot_time_to_sec;
// Converts Total Seconds to Days and Time
NumberVar Days    := Truncate  (tot_sec / 86400);
NumberVar Hours   := Truncate  (Remainder ( tot_sec , 86400) / 3600) ;
NumberVar Minutes := Truncate  (Remainder ( tot_sec , 3600) / 60) ;
NumberVar Seconds := Remainder (tot_sec , 60) ;
if Days=1 then Totext ( Days ,    '####' ) +  ' Day   ' + Totext ( Hours ,   '00' ) +  ':' + Totext (Minutes, '00' ) +  ':' + Totext ( Seconds , '00' )
else Totext ( Days ,    '####' ) +  ' Days  ' + Totext ( Hours ,   '00' ) +  ':' + Totext ( Minutes , '00' ) +  ':' + Totext ( Seconds, '00' );
Hope this works,
- Kiran
Edited by: Kiran Suravajhala on Feb 7, 2012 7:17 PM

Similar Messages

  • Diffrence between working days & calander days

    HI Gurus,
                 What is diffrence between working days and calander days.
    In case of GR processing time in materail master it is working days but in case of planned delivery time it is calander days. Means planned delivery time is not consideruing any holidays, right.....
    Regerds
    ACP

    Hi
    Workings days ; will list the working days without the holidays.but
    calender days ; consider also the leave days also.
    so in GR processing time  is used to the interal acitivities say that after receive the material GR the material need to do the  GR process timing say inspection and documentations , then the material located to the Raw material sto location.
    so the GR processing time  is purelu based on the plant activies. so it consider the Working days only.
    but in  planned delivery time  is given for vendor to delivary the material. so it consider the calender days .

  • [CRM to BI] Servcie Order duration in working days (local calendar)

    Hi all,
    We need to analyze in BI reporting service orders and duration of open orders in working days according to local calendar
    How to send data from CRM to BI?
    Standard extractors 0CRM_SRV_PROCESS_H / 0CRM_SRV_PROCESS_I send information about date of order ceration, order completion, status, etc
    How to do it according to standards?
    Do I need to set up custom Duration Type (SPRO - Date Management), add it to the Service Order document type and expand standard extractor of service orders?
    Or probably it is better to calculate working days in BI according to date of order creation?
    Thanks!

    Hi,
        check this link Equipment Downtime
    I believe u may have to recalculate the breakdown hrs using some FM in user exit QQMA0014 QM/PM/SM: Checks before saving a notification

  • Working days between two date fields and Changing Factory Calendar

    Hi,
    I have to calculate working days between two date fields excluding the weekends and public holidays for Switzerland.
    I have written the routine using factory calender and its working fine except for two problems now:
    1. If any one of the date field is empty then teh rsult should be zero.
    2. And the below code is working from 1996 but my cleints wants it to work for years before 1996 as well.
    I also tried to change the Start date in SCAL for factory calendar but it says enter values between 1995 to 2020.
    I am new to ABAP. Please help me how i can achieve these for below code.
    DATA: IT_HOLIDAYS type TABLE OF ISCAL_DAY,
          IS_HOLIDAYS TYPE ISCAL_DAY.
    DATA: T_DATE TYPE SY-DATUM,
          P_DATE TYPE SY-DATUM.
    DATA : X_DATE(4) TYPE C.
    DATA: CNT TYPE I.
    REFRESH : IT_HOLIDAYS.
    CLEAR : IT_HOLIDAYS.
    T_DATE = SOURCE_FIELDS-/BIC/ZCCCHP812.
    P_DATE = SOURCE_FIELDS-/BIC/ZCCCHP810.
    CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
    HOLIDAY_CALENDAR = 'CH'
    FACTORY_CALENDAR = 'CH'
    DATE_FROM = P_DATE
    DATE_TO   = T_DATE
    TABLES
    HOLIDAYS = IT_HOLIDAYS
    EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1
    HOLIDAY_CALENDAR_NOT_FOUND = 2
    DATE_HAS_INVALID_FORMAT = 3
    DATE_INCONSISTENCY = 4
    OTHERS = 5.
    DESCRIBE TABLE IT_HOLIDAYS LINES CNT.
    X_DATE = T_DATE - P_DATE - CNT.
    RESULT = X_DATE.
    Please help
    Regards
    Zabina
    Edited by: Syed786 on Nov 2, 2011 9:15 AM

    Hi Zabina,
    Try this function module  'DURATION_DETERMINE'.
    Give the factory calendar and unit as DAY
    With regards,
    Rajesh

  • ABAP - Function module to get the number of working days between 2 days

    Hi gentlemen,
    I have been asked to produce a report that gives the number of working days between 2 days, based on a calendar.
    I didn't find anything...
    Has any of you already written a function module to get this ?
    A great thanks in advance.
    Jacques Lagrif

    Hi ,
    you can try this ,
    when you require the number of working days between D1 and D2
    Total No of Days will be
    D2 - D1
    No of holidays between D1 and D2 , use the FM HOLIDAY_GET
    Pass the From date , to date , and the factory calendar to get the of Holidays
    Total no of days - Number of Holidays will your Working days
    Regards,
    Sathya

  • Calculation of no. of working days (per Factory Cal) between 2 date chars

    This question could be considered to be in continuation of a previous post called "Working days of month with factory calendar"
    I have two date Characteristics: say Date1 and Date2. I need to find the number of working days between them based on the factory calendar.
    (And yes we have already defined the default factory calendar in IMG under 'General Reporting settings' ).
    The previous post proposed the following:
    1) Convert date1 into factorydate (standard functionmodule)
    2) Convert date2 into factorydate (standard functionmodule)
    Perform date1 - date2 to get number of working days.
    I agree that there is a std function module to convert cal date to factory date called: 'DATE_CONVERT_TO_FACTORYDATE'
    But what are the steps for calling the conversion? Should I create a new Formula variable of 'Customer Exit type' give it a name and define the Function module in CMOD? But then how do I attach the formula variable to the date characteristic. Note that my infoobjects are Chars so I cannot do date1- date2 in the query as is possible with keyfigures!
    Please help! (my version is BW 3.0)
    Thanks
    Naresh

    Hi,
    For the above scenario when you need to calculate date 1 - date 2. we can't build a new formulae or calculated KF directly because those are the chars.
    So we need make chars to act as KF through Formulae with replacement path.
    create a formulae variable on those 2 Date chars with Processing type as replaccement then those 2 Dates can be avilable to build a formulae as ur requirement.
    Let me know if you need any more information.
    Thanks,
    Raju

  • Calculate Working Days between Two Dates

    Hi All,
    I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
    I'm not using procedure or command, Operating directly with tables.
    Any help would be appreciated.
    Regards
    Edited by: Pari Minhas on Nov 24, 2011 12:00 AM

    Hi All,
    I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
    I'm not using procedure or command, Operating directly with tables.
    Any help would be appreciated.
    Regards
    Edited by: Pari Minhas on Nov 24, 2011 12:00 AM

  • I need FM calc. days/months/years between 2 dates but computes the work day

    I need FM calc. days/months/years between 2 dates but computes the work day.
    someone knows ?

    Hi,
    The FM is 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    Check the following example:
    DATA: EDAYS   LIKE VTBBEWE-ATAGE,
          EMONTHS LIKE VTBBEWE-ATAGE,
          EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
                TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Regards,
    Bhaskar

  • Calculating duration between cue point?

    I'm using Flash Pro CS3. My project is AS2 targeting FP8.
    I have an flv component on stage. My .flv has cue points and
    I have buttons underneath the component that show the title of each
    navigation cuepoint in a dynamic text field. I have another dynamic
    text field that shows the cuepoint time for each cuepoint,
    positioned next the the title of the cuepoint. That all works well
    but hoping to accomplish a bit more and can't find any code help.
    The three things I'm trying to do are:
    1. Instead of showing current time at a particular cuepoint,
    show the duration of the section/chapter, if you will. How can I
    calculate duration between two cuepoints and display it in my
    dynamic text field? Is there something I should do when
    encoding/adding the cuepoints or can I use AS with the cuepoints I
    have?
    2. Once I get that duration and have it display instead of
    the actual cuepoint time, have it countdown backwards when the
    playhead is in that "chapter"?
    3. Show these times in the mm:ss format?
    Thanks for any help or links you think might be helpful...
    -Scott

    Function Modules related to Date and Time Calculations
    CALCULATE_DATE : Calculates the future date based on the input .
    DATE_TO_DAY : Returns the Day for the entered date.
    DATE_COMPUTE_DAY : Returns weekday for a date
    DATE_GET_WEEK : Returns week for a date

  • FM to calculate Number of working days adjusted for an employee -ABAP HR

    I have one requirement in which i have to Calculate "Number of working days adjusted" for an employee for a disability program.
    In this context i wanna know, if just get difference between two dates (i.e the duration for which employee was compensated ) based on Holiday calender...Will this give give me "Number of working days adjusted"  for an employee or i have to consider work schedule for an employee? If yes , Then please let me know sm FM to calculate number of working days between two dates speific to an employee.

    check
    HR_PERSONAL_WORK_SCHEDULE
    HR_GET_QUOTA_DATA

  • Human tasks on working days

    How can I do to make Human task's expiration days count only working days?

    Here's a bit of Java code to generate the string for 8 hour expirations only on days of M-F. It assumes a BPEL variable named strExpirationMinutes of type string has been created. You can pass the variable in to the human task as a parameter and directly assign it via XPath on the task configuration screen.
    String tmp = "PT";
    int iMins = 0;
    int hrs8 = 60*8;
    int hrs23 = 60*23;
    int hrs24 = 60*24;
    java.util.Calendar calNow = java.util.Calendar.getInstance();
    int hours = calNow.get( java.util.Calendar.HOUR_OF_DAY );
    int minutes = calNow.get( java.util.Calendar.MINUTE );
    int dow = calNow.get( java.util.Calendar.DAY_OF_WEEK );
    // if a M-T
    if (dow>=2 && dow<=5) {   
    // if starting before 8 am - add 8 hours plus the interval between now and 8 am
    if (hours<8) {   
    iMins = (60-minutes) + ( (8-hours-1)*60 )+ hrs8;
    // if starting between 8 am and 9 am - just add 8 hours
    } else if (hours==8 || ( hours==9 && minutes==0) ) {   
    iMins = hrs8;
    // if starting between 9 am and 5 pm - just add 23 hours
    } else if (hours>=9 && (hours<17 || (hours==17 && minutes==0)) ) {   
    iMins = hrs23;
    // if starting after 5 pm - add 8 hours plus the interval between now and 8 am
    } else {   
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8;
    // if Fri
    } else if (dow==6) {   
    // if starting before 8 am - add 8 hours plus the interval between now and 8 am
    if (hours<8) {   
    iMins = (60-minutes) + ( (8-hours-1)*60 )+ hrs8;
    // if starting between 8 am and 9 am - just add 8 hours
    } else if (hours==8 || ( hours==9 && minutes==0) ) {   
    iMins = hrs8;
    // if starting between 9 am and 5 pm - add 23 hours plus the two we days
    } else if (hours>=9 && (hours<17 || (hours==17 && minutes==0)) ) {   
    iMins = hrs23 + hrs24 + hrs24;
    // if starting after 5 pm - add 8 hours duration plus the interval between
    // now and 8 am saturday, plus the 2 we days
    } else {   
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8 + hrs24 + hrs24;
    // if Sat
    } else if (dow==7) {   
    // add 8 hrs duration, plus the time between now and midnight sat, plus
    // all of sunday, plus 8 hrs for monday before 8 am
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8 + hrs24;
    // if Sun
    } else {   
    // add 8 hrs duration, plus the time between now and midnight sun, plus
    // 8 hrs for monday before 8 am
    iMins = (60-minutes) + ( (24-hours-1)*60 ) + hrs8 + hrs8;
    // finish build the time string
    tmp = tmp + iMins + "M";
    // save the string to bpel proc and audit
    setVariableData("strExpirationMinutes", tmp);
    addAuditTrailEntry("strExpirationMinutes:",tmp);

  • Calculate duration between start date and end date

    Hi everyone,
    I'm facing with problem when calculating duration between start & end with this function below . This fuction  is working well, but i want to change working time from 8:00 am to 17:30 pm instead of 17:00 , and lunch time from 12:00 to 13:30 instead
    of 13:00 as present . Problem is , i changed data type of start hour and end hour from INT to decimal . But it is still wrong .
    Pls help me . It's very urgent bcoz i need it for monthly report .
    Many thanks .
    Here is function which im using :
    ALTER Function [dbo].[GetWorkingMin](@pStartDate DateTime, @pEndDate DateTime) Returns Int
    AS
    Begin
          Declare @StartDate DateTime = @pStartDate
          Declare @EndDate DateTime = @pEndDate
        Declare @WorkMin int = 0   -- Initialize counter
        Declare @Reverse bit       -- Flag to hold if direction is reverse
        Declare @StartWorkingHour int = 8   -- Start of business hours (can be supplied as an argument if needed)
        Declare @EndWorkingHour int = 17    -- End of business hours (can be supplied as an argument if needed)
        Declare @Holidays Table (HDate DateTime)   --  Table variable to hold holidayes
          Declare @LunchHour int = 12
          Declare @StartHour int = DatePart(HH, @StartDate)
          Declare @EndHour int = DatePart(HH, @EndDate)
        -- If dates are in reverse order, switch them and set flag
        If @StartDate>@EndDate
        Begin
            Declare @TempDate DateTime=@StartDate
            Set @StartDate=@EndDate
            Set @EndDate=@TempDate
            Set @Reverse=1
        End
        Else Set @Reverse = 0
        -- Get country holidays from table based on the country code
        Insert Into @Holidays (HDate) Select HDate from HOLIDAY Where HDATE>=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)
        If DatePart(HH, @StartDate)<@StartWorkingHour
        begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate))  
                -- If Start time is less than start hour, set it to start hour
                Set @StartHour = DatePart(HH, @StartDate)
        end
        If DatePart(HH, @StartDate)>=@EndWorkingHour
        begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
                -- If Start time is after end hour, set it to start hour of next day
                Set @StartHour = DatePart(HH, @StartDate)
                --return DatePart(day, @StartDate)
        end
        If DatePart(HH, @EndDate)>=@EndWorkingHour
        begin
                Set @EndDate = DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @EndDate))
                -- If End time is after end hour, set it to end hour
                Set @EndHour = DatePart(HH, @EndDate)           
        end
        If DatePart(HH, @EndDate)<@StartWorkingHour
        begin
                Set @EndDate = DateAdd(hour, @EndWorkingHour-24, DateDiff(DAY, 0, @EndDate))
                -- If End time is before start hour, set it to end hour of previous day
                Set @EndHour = DatePart(HH, @EndDate)
        end
        If (@StartHour>=@LunchHour and @StartHour < (@LunchHour +1))
        Begin
                Set @StartDate = DateAdd(hour, @LunchHour + 1, DateDiff(DAY, 0, @StartDate))
                -- If Start time is in lunch time, set it to 12
                Set @StartHour = @LunchHour + 1   
        End
        If (@StartHour>=@LunchHour and DatePart(DW, @StartDate) = 7)
        Begin
                Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
                Set @StartHour = DatePart(HH, @StartDate)
        End
        If (@EndHour>=@LunchHour and @EndHour < (@LunchHour +1))
        Begin
                Set @EndDate = DateAdd(hour, @LunchHour +1, DateDiff(DAY, 0, @EndDate))
                -- If End time is in lunch time, set it to 13
                Set @EndHour = @LunchHour + 1
          End
          If (DatePart(DW, @EndDate) = 7 and DatePart(HH, @EndDate) >= @LunchHour) Set @EndDate = DateAdd(hour, @LunchHour, DateDiff(DAY, 0, @EndDate)) -- If End day is Saturday and End time is after end hour, set it to end hour of saturday
        If @StartDate>@EndDate Return 0
        -- If Start and End is on same day
        If DateDiff(Day,@StartDate,@EndDate) <= 0
        Begin
            If (Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7)  
            -- If day is between sunday and saturday
                If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0  
                -- If day is not a holiday
                    If @EndDate<@StartDate Return 0 Else
                    Begin
                                  Set @WorkMin=DATEDIFF(MI, @StartDate, @EndDate)
                                  -- Calculate difference
                                  If (@StartHour <= @LunchHour and @EndHour >= @LunchHour + 1)
                                        Set @WorkMin = @WorkMin - 60;                                   
                            End
                Else Return 0
            Else Begin
                      if (DATEPART(dw,@StartDate)=7) set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, @EndDate);
                      Return @WorkMin
            End
        End
        Else Begin
            Declare @Partial int=1   
            -- Set partial day flag
            While DateDiff(Day,@StartDate,@EndDate) > 0   
            -- While start and end days are different
            Begin
                If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7    --  If this is a weekday
                Begin
                    If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0  -- If this is not a holiday
                    Begin
                        If @Partial=1  
                        -- If this is the first iteration, calculate partial time
                        Begin
                            Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @EndWorkingHour, DateDiff(DAY, 0, @StartDate)))
                            If (@StartHour <= @LunchHour) Set @WorkMin = @WorkMin - 60;
                            Set @StartDate=DateAdd(hour, @StartWorkingHour+24, DateDiff(DAY, 0, @StartDate))
                            Set @Partial=0
                        End
                        Else Begin     
                        -- If this is a full day, add full minutes
                            Set @WorkMin=@WorkMin + (@EndWorkingHour-@StartWorkingHour - 1)*60        
                            Set @StartDate = DATEADD(DD,1,@StartDate)
                        End
                    End
                    Else Set @StartDate = DATEADD(DD,1,@StartDate)  
                End
                Else Begin
                            If (DATEPART(dw,@StartDate)=7)
                            Begin                   
                                  Set @WorkMin = @WorkMin + DATEDIFF(MI, @StartDate, DateAdd(hour, @LunchHour, DateDiff(DAY,
    0, @StartDate)));
                            End
                            --Set @StartDate = DATEADD(DD,1,@StartDate)
                            Set @StartDate = DateAdd(hour, @StartWorkingHour + 24, DateDiff(DAY, 0, @StartDate))
                                  Set @StartHour = DatePart(HH, @StartDate)
                      End
            End
            If Datepart(dw,@StartDate)>1 And DATEPART(dw,@StartDate)<7  
            -- If last day is a weekday
                If (Select Count(*) From @Holidays Where HDATE=DateAdd(dd, DateDiff(dd,0,@StartDate), 0)) = 0   
                -- And it is not a holiday
                    Begin
                                  If @Partial=0 Set @WorkMin=@WorkMin + DATEDIFF(MI, @StartDate, @EndDate) Else
    Set @WorkMin=@WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @StartDate)), @EndDate)
                                  If (@EndHour >= (@LunchHour + 1)) Set @WorkMin = @WorkMin - 60;
                            End   
                If (DATEPART(dw,@EndDate)=7)
                Begin
                      Set @WorkMin = @WorkMin + DATEDIFF(MI, DateAdd(hour, @StartWorkingHour, DateDiff(DAY, 0, @EndDate)),@EndDate);        
                End
        End
        If @Reverse=1 Set @WorkMin=-@WorkMin
        Return @WorkMin
    End

    The problem is you cannot specify partial hours.
    I think your best bet would be to alter the function sufficiently so it will accept times instead of hours, and where you're making comparisons to the hour, use dates/date functions instead.
    Then, just set the variable as a full time (or datetime, if you need).

  • Summary task displaying entire duration between split tasks

    Hi,
    I have two task under one summary task that are each only one day in duration (the one starts and finishes on 3 March, the other starts on 7 April) but the summary task displays a duration of 25 days. How do I make the summary task only count duration as
    2 days and not 25 days?
    Thanks, Jaco

    Jaco,
    Ben is right, when using Project it is necessary to understand the difference between duration and work, so let me try and give you a quick study.
    Duration is simply a span of time. For a summary task, it is the working time from the start of the first subtask through the finish of the last subtask. Duration accomplishes nothing. Duration is not additive.
    Work on the other hand is the effort needed by one or more resources to actually accomplish the task. Work is additive. If a single resource is assigned 100% to a task then the duration and work will be the same. I
    In your case, if a single resource is assigned to the first task, the duration of that task will be 1 day and the work content will be 8 hours. For the second task, the duration of that task will be 2 days with a work content of 16 hours. The total duration
    of both tasks, given the start and finish dates you indicate (assuming a normal standard calendar) is actually 27 days but the total work content of both tasks is 24 hours.
    Hope this helps.
    John

  • Working days formula and Crystal 7 - is it possible?

    Post Author: Tim F
    CA Forum: Formula
    Hi folks,
    Really hope someone can help, I'm struggling with writing a report that needs to show the difference between two dates in working days. I've found the same formula posted here several times but cannot get it to return a logical value in my report. I'm wondering if that might be because I'm using an older version of Crystal? The formula in question is this one:
    //Main formulaWhileReadingRecords;Local DateVar Start := ({PPV_COMPLAINTSEH.DTRECD});   Local DateVar End := ({PPV_COMPLAINTSEH.ACTCMPLTD}); Local NumberVar Weeks; Local NumberVar Days; Local Numbervar Hol;DateVar Array Holidays;
    Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;Days := DayOfWeek(End) - DayOfWeek(Start) + 1 + (if DayOfWeek(Start) = 1 then -1 else 0)  + (if DayOfWeek(End) = 7 then -1 else 0);  
    Local NumberVar i;For i := 1 to Count (Holidays)do (if DayOfWeek ( Holidays&#91;i&#93; ) in 2 to 6 and      Holidays&#91;i&#93; in start to end then Hol:=Hol+1 );
    Has anyone come across an alternative way of doing this, or have any ideas why this formula is not working in my report? Any advice would be much appreciated,
    Regards,
    Tim

    Post Author: Charliy
    CA Forum: Formula
    You set up a Running Total.  Drag the filed you want Summed, Select Sum as the operation if that is not the default.
    Just below that you weill see Radio Buttons that say For Every Record, On Change of Group, On Change of Field, Use a Formula, etc - click the one that says Use a Formula.  The Blue Bos to its right will turn Red, click on it, this is where you put your formula: NOT(DATEPART('w',{table.date}) IN &#91;6,7&#93;)
    Save that, then just decide if you want it reset on a Change of Group, or Never (Grand Total).  Give it a name and put it on your report.

  • SAP HR : Wrong working days displayed in Z report

    Dear Friends ,
    I have made a z report for SAP- Hr to show working days of employee of a particular month
    when I am running report for all the employees then working days are wrongly displayed in alv
    report but when I am running the report for a particular employee then the working days are
    correct . I have done debugging also , every thing is fine in debugging , Now I am confused
    where is fault I have to run the report for all employee.
    Kindly suggest .
    Regards
    Rihan
    SAP-abaper

    hye ,
    here, some code for your reference ,
    LOOP AT it_empall WHERE pernr EQ stru-pernr.
          SELECT SINGLE SUM( abwtg ) FROM pa2001
                              INTO absdays
                              WHERE pernr = it_empall-pernr
                              AND   endda BETWEEN p_begda AND p_endda
                              AND   begda BETWEEN p_begda AND p_endda.
    "FOR RESIGN
            select single begda from Pa0000 into enddt where pernr eq it_empall-pernr
                                                       and massn eq 'H6'.
    "FOR HIRING
             select single begda from Pa0000 into begdt where pernr eq it_empall-pernr
                                                       and massn eq 'H1'.
         totdays = p_endda - p_begda.
          totdays = totdays + 1.
         if enddt GT p_begda and enddt LT p_endda.
                           X = ( p_endda - enddt ) + 1 .
                           workdays = totdays - x - absdays.
                           stru-kaltg = workdays.
         elseif begdt GT p_begda and begdt LT p_endda.
                          X = ( begdt - p_begda ) .
                          workdays = totdays - x - absdays.
                          stru-kaltg = workdays.
         else .
                          workdays = totdays - absdays.
                          stru-kaltg = workdays.
         endif.
      ENDLOOP.
    Note : here p_begda AND p_endda are month start and end date.
              and begdt and enddt  (  these are  employee joined and resigned date)
    Pls suggest .....

Maybe you are looking for

  • Adjusting the Maximum Power level Assignment Value

    I have a deployment of AIR-CAP35021 APs. They are in 2 buildings with multiple floors. They are installed in a row down the hallways. I want to increase the power levels by using the controller and not configuring the APs individually. I have set the

  • Purchase Order Backend Error!!

    Hi Experts, We are in SRM 5.0 EBP 4.0 extended classic scenario. In a particular case, I find that when a Purchase Order was changed and ordered, it went into backend application error as I could see the same in RZ20 . The alert read " Purchase Order

  • Z10 browser issue

    Hello all, Big issue for the last 4 days.  I am on BB10, Z10, Model STL100-1, 10.2.1.2977, OS- 10.2.1.3247 My personal space browser suddenly stopped working. checked online, many have faced this issue and solutions involve deleting history etc but a

  • Usage of relative url across site collections in sharepoint 2010

    Hi I have a webapplication with 2 sitecollections. In one sitecollection, created a link by going to navigation under sitesettings. Added relative url to map to 2nd site collection. Eg: /sites/site2/page1.aspx But by doing so, it is giving error. Hel

  • How to open RAW files using elements 10 with a pc using windows xp and nikon D3300

    i have an old pc running on windows xp to which i downloaded elements 10. i recently bought a nikon d3300 and am shooting RAW. is there a way to open the RAW files using elements 10?