Date and Time Calculation in Bex.

Hi All,
I want to calculate the number of days and the time by subtracting from two dates and time.
Ex : 27-Jan-2009 10.30AM  - 20-Jan-2009 10.00AM
Result : 6 days 23 hrs
In my ODS, i have FROM date, time and TO date,time are in Characteristics.
is it possible do it in the Query designer.
Pls provide me the steps.
Thanks,
Ram.
Edited by: Ram Siva on Jan 27, 2009 6:29 AM

Hi,
it is possible in query designer,
u do the two things for getting the days between to dates
1) in CMOD write the code for sy-datum create a customer exit variable in query as on caldate like eg zcedate
when 'zcedate'.
clear l_s_range.
l_s_range-sign = 'i'.
l_s_range-opt = 'eq'.
l_s_range-low = sy-datum.
append l_s_range to e_t_range.
u write this code exit_saplrrso_001.
it givs the sydatum
2) then u create one more variable on zdate limit with replacement path
then u go forto create the formula variable then it display ascreen there u select both customer exit variable and replacement path variable
zcedate-replacementpathvariable
it gives days i worked on this and succedded.
like the same way fortime also u can do but here at the time of creating the customer exit varible u go for option as range here
l_s_range-low = '20012009'
l_s_range-high = '29012009'
l_s_range-sign ='i'.
l_s_range-opt = 'bt'.
please try with the above one.
Thanks & rEgards,
k.sathish

Similar Messages

  • Date and Time calculation in the Service Module

    Dear all,
    I have quite of a challenge here and i need serious guidance from your side.
    My client is in services industry and requires to calculate the date and time when the service call as to be closed. Not only it depends on the contract type the service is linked to but as well on the priority.
    The priority in Business One is unique, therefore we created a UDT (User Defined Table) to store the different 'response time' per contract/per priority. Example: a Platinum contract is always 24/7. But a gold contract priority 1 has to be closed in 240 minutes (4 workable hours) while a gold contract priority 2 has to be closed in 480 minutes (8 workable hours).
    I created 7 user defined fields on the Service Contract header that calculates the workable minutes per day. So if my coverage for Monday is from 8 AM to 4 PM, my UDF called DiffMon will show 480. For Tuesday, they start a bit later, and the coverage is 8:30 untill 16:00, therefore my UDF called DiffTue = 450.If the check box before the day in the Service Contract window is not ticked, then the UDF shows zero.
    I succeeded to calculate the expected closing time by using CASE WHEN statements as following, (all calculated in minutes):
         First, I need to check which day the Service call is created: A Monday or Thursday or... since my time coverage can change every day! I use SET DATEFIRST = 1 and compare today's date accordingly with my UDF DiffMon, DiffTue, etc.
         Then, When end of coverage time today Monday (4PM) minus the create time on the Service Call (1PM) is less then the time stored in my user defined table for that contract and that priority (i.e.480), then just add that to the create time and the create date (DateAdd(mi,...,...) ).
        When end of coverage time Monday (4PM) - Create time (1PM) + DiffTue(450) is bigger than 480, then I know I have enough time to solve my service call tomorrow Tuesday and I take the start time of Tuesday (8:30) + remaining time from yesterday (480-180 -> 180 = 3hours from 1PM to 4PM) and add that to the Create date + 1 so the end result will show Tuesday date and a time of 13:30
       Etc. untill I cover all possibilities based on which day is the service call created.
    NOW, I need to include the holiday table !!!!!!!!!!  And I can't foresee how the hell I am going to do that.
    The maximum coverage can go up to 60 hours, that means more than a working week! What happens if I have more than one bank holiday in that week period? What happens when my holiday table tells me that  date is a bank holiday but it is actually a Sunday and my contract is only running from Monday to Friday?
    Am I going straight to a big mess up?
    I will highly appreciate your comments,
    Regards,
    Frederic

    Hi,
    it is possible in query designer,
    u do the two things for getting the days between to dates
    1) in CMOD write the code for sy-datum create a customer exit variable in query as on caldate like eg zcedate
    when 'zcedate'.
    clear l_s_range.
    l_s_range-sign = 'i'.
    l_s_range-opt = 'eq'.
    l_s_range-low = sy-datum.
    append l_s_range to e_t_range.
    u write this code exit_saplrrso_001.
    it givs the sydatum
    2) then u create one more variable on zdate limit with replacement path
    then u go forto create the formula variable then it display ascreen there u select both customer exit variable and replacement path variable
    zcedate-replacementpathvariable
    it gives days i worked on this and succedded.
    like the same way fortime also u can do but here at the time of creating the customer exit varible u go for option as range here
    l_s_range-low = '20012009'
    l_s_range-high = '29012009'
    l_s_range-sign ='i'.
    l_s_range-opt = 'bt'.
    please try with the above one.
    Thanks & rEgards,
    k.sathish

  • Need help with date and time calculations please

    Hello there.. Im stuck, and im hoping someone can help..
    Working on a list to manage and track PTO.  User completes PTO request form,
    Fields
    Name
    Start Date (with time)
    End Date (with time)
    Total Number of Days/hours requested: (calculation)
    Full Day: (Yes/No)
    ok business need
    user has the ability to request a certain number of hours as opposed to a full day.
    After searching around on google. I found this calculation to help me figure out how many BUSINESS days being requested.
    =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))
    This works great as long as its a [Full Day]="YES", displays results in column labeled Number of days
    now if [Full Day]="No", displays results in column labeled Number of Hours
    BUT this is my issue (well part of it) it calcuate the correct number of hours.. but puts a "1" in "Number of Days" why.. dates have not changed.. I think Its something with the above calculation but I could be way off.
    the end result is I need number of days to concat with number of hours 
    i.e 1 full day 4 hours  1.4
        0 full day 5 hours  0.5
        1 full day 0 hours  1.0
    so that the total can be deducted via workflow.. from the remaining balance in a tracker. (seperate list) 
    Any angels out there??

    Posnera-
    Try changing time zones and see if the travel itinerary times change.
    Fred

  • Date and Time Calculation

    Dear all.
       I need a function that receives a Date / Time and another Date and calculates the the sum of those values.
    Best Regards,
    Thanks In advanced.
    PMR

    Hai Rodrigues,
    The function module CALCULATE_DATE also adds/subtracts days and months to/from a date. The following website also demonstrates a number of ways to add days/months taking into account working and non working days if that is any use. http://www.sapdevelopment.co.uk/tips/date/datehome.htm
    CALL FUNCTION 'CALCULATE_DATE'
    EXPORTING
    DAYS = '0'
    months = '01'
    start_date = p_date
    IMPORTING
    result_date = p_date.
    You can even check this function modules, it works fine.
    Function Module Name:: ADD_TIME_TO_DATE
    Short Description :: Adds months/days/years to date.
    Entering a negative value will subtract from the date.
    Parameters ::
    Exporting:
    I_IDATE : Initial date
    I_TIME : Quantity to add
    I_IPRKZ : Unit of time(D:day, M:month, W:week, Y:year)
    Importing:
    O_IDATE : OUTPUT DATE
    Regards,
    Srikanth.

  • There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator.

    There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator. However, when i lower it, my safari tab goes out of the screen. What do you guys think i should do? I'm getting very nervous.

    hey HAbrakian!
    You may want to try using the information in this article to adjust the behavior of your function keys to see if that resolves the behavior:
    Mac OS X: How to change the behavior of function keys
    http://support.apple.com/kb/ht3399
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • Date and time diffrence calculations

    Dear Experts,
    I have a doubt regarding the date and time diffrence calculation please help me out.
    This is regarding the report called u201CVehicle tracking systemu201D. The purpose of this report is to give the user information like how many vehicles have come in and how much time each vehicle has parked in the filling in the refinery and also the average time taken for a customer.
    For this we have created 4 info objects called
    1)     Park In Time
    2)     Park In Date
    3)     Gate Out Time
    4)     Gate Out Date
    We have created a routine which calculate the difference in Vehicle Park In Date & Time to Gate Out Time and Date
    The Time difference is number format.
    Example: For Vehicle1
    Park in Date and Park in Time are         27.11.2008 and 17:43:35
    Gate out Date and Gate out Time are     29.11.2008 and 09:36:16            
    Here routine will calculate the difference in the above date and time and the output is like this     1,155.138,000 (i.e. 1day, 15 hours 51 mins and 38 seconds) that means the vehicle has parked for 1 day and 15 hours etc.
    But we require the output like    1 day, 15:51:38
    Please give us the solution how to go about it.
    Thanks in advance,
    venkat

    Hi,
    I think in regard to your problem, the solution will be to make the variables in the query runtime by the replacement path variable.
    Please find the below link, its very much self explanatory and in regard to your problem.
    Hope it helps!
    [http://sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html]
    Regards,
    Neha.

  • SAP BI Date and Time Difference calculations in DSO Transformation

    Hello Guys,
    Could you please tell me how to calculate the date and Time difference between 2 fields.
    I have 2 date fields :
    Arrival Date : 6/16/2007
    Departure date : 6/19/2007
    Also i have 2 time fields for the above
    Arrival Time : 13:00:00
    Departure Time : 11:50:00
    I want to display all the four fields and 2 fields for the difference in Date and Time.
    Is it better to calcuate the differences in DSO Transformation or can you do it in the report itself.Could you please let me know the solution.
    Thanks,
    BI Consultant

    Hello Consulant BI,
    Computing the difference of two dates is easy (assuming you really just want the number of days). You can simply subtract the two dates using ABAP:
    data: w_arrival_date type sy-datum,
            w_dep_date type sy-datum,
            w_diff type i.
    w_arrival_date = <your arrival date field here>.
    w_arrival_date = <your departure field here>.
    w_diff  = w_arrival_date - w_dep_date.
    Getting the time difference isn't really much logical. I think what you want instead is to compute the totals days (and extra hours) right? If this is the case, then you can convert the date+time for both the arrival and departure  into a timestamp variable first and then t the get difference.
    Hope this helps.

  • Odd Date for Current Date and Time

    I am modifying a column in a list to get current date and time using =TODAY()+NOW() in the calculated field and get a time that is behind by 1 hour but the date is 4 months 114 years ahead (2128). How can I fix this field?

    http://sharepointsolutions.com/sharepoint-help/blog/2011/04/how-to-add-and-subtract-hours-and-minutes-from-date-and-time-fields-in-sharepoint-lists/

  • Date and time field help

    Hey guys and gals,
    I'm working on a basic simple form that I'd like to use as a fax cover sheet and I'm brand new at this and I just can't find the answer anywhere. The only way I can get it to show the date and time is if I choose calculated - read only, then runtime property. But then it changes every time you open the document. It doesn't autofill the date and time any other way. Is there a way to make the date and time auto fill ONLY the first time you fill it out and then lock that field? Or do you just have to choose one of the other options, i.e., user entered - optional, recommended or required and then type it in? Which I don't really get either, because those just give you a blank field that you type in. I don't see the difference between those options and a text field. I thought maybe I could upload the pdf to show you, but I guess you can't do that here. Anyway using Acrobat 9 pro on Vista.

    It sounds like you're using LiveCycle Designer, not Acrobat, to create the form. If that's the case, you should post this question in the LiveCycle Designer forum: http://forums.adobe.com/community/livecycle/livecycle_modules_and_development_tools/livecy cle_designer_es

  • Incrementing a string number for date and time

    There are probably a lot of ways to do this, but I only want to use a bunch of if - else loops if I really need to.
    I have a date and time for input, let's say 2006-04-19 22:00. In Java, if I convert that to 3 integers (year, month, day), it will output 2006-4-19. I need to be able to increment in a loop for every day and month from one date to the next. If I keep it as a string, I won't be able to increment the value though, (at least I'm not sure how). I'm thinking that even if I converted it to an integer and back to a string, that the leading zero would be removed.
    I found a post here that said something about formatting the number with 2 numbers, by using:
    DecimalFormat format = new DecimalFormat("00");
    format.format(1, sb, new FieldPosition(0));
    Or is there a way to use the gregorianCalendar stuff that would output the date with all of the zeros in place, while incrementing and looping correctly?
    Thanks.

    I would get a Date object--you can use java.text.SimpleDateFormat if you're starting with a String--and use that to create a GregorianCalendar. Then you can just call Calendar's add method to add one to whichever field you want. Use the SimpleDateFormat to turn the date back into a String for display again.
    Calculating Java dates: Take the time to learn how to create and use dates
    Working in Java time: Learn the basics of calculating elapsed time in Java
    Formatting a Date Using a Custom Format
    Parsing a Date Using a Custom Format

  • Automatically displaying date and time in a date/time field on form initialize

    Good day all;
    I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.
    I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.
    I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…
    Please let me know where I am going wrong
    Chomp

    Found the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.
    You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.
    When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.
    1.
    In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.
    2.
    In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.
    3.
    Select the Runtime Property option.
    4.
    View the form in the Preview PDF tab.

  • How to display last data update date and time in report?

    Hai All,
               I want to report the date and time of the last upload in a report. How can I do this?
    I mean if I load the data today 5th April 2006 at 8.30 pm, then would i be able to show that on my report at the top of it(along with filer objects may be)?
    Thank you.

    Hi Visu,
    You will find detail info from help.sap
    check the links and they are  useful
    BEX Analyzer:
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/4e9d39d44cd45ee10000000a11402f/frameset.htm
    Web Application Designer
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/4e9d39d44cd45ee10000000a11402f/frameset.htm
    -Doodle
    Message was edited by: Doodle

  • Current Date and Time control

    Hi,
    I'm using the Current Date control on my form.  This is OK for the date but I need the current time on a seperate control.
    I see it has binding options in the Object section ie date, date and time and time but only date seems to work.
    Does anyone know how I can set this to display the time only?
    thanks
    Paul

    Yes, that should be the answer.  But, as I said, when I select time only it still displays date and time.
    In the 'Value' tab, I've been trying different settings.  I set Type to User Entered options and Calculated options.  I only get a blank unless I set this to "Calculated - Read Only" and set the runtime property to the only option available which is 'Current Date/Time'
    So, there must be another setting that I need?
    thanks,
    Paul

  • How Production Order finish date and time is being comptued by SAP?

    Hello Expert,
    How Production Order finish date and time is being comptued by SAP? for example, we create a Production Order via CO01, the basic start date is 29.09.2008 and time is 04:00 it gives us basic finish date is 29.09.2008 and time is 13:28.
    how does SAP compute the time 13:28 as it finished time
    Please explain me briefly.
    Thanks
    Ryan

    Hello Guys,
    When we create Production Order in R/3 the time is calculated by routing but it is extended at SetUp machine time. It is not correct?. SetUp imachines time used only for first Production Order for the same product and it is plan manually, for others Production Order we need calculate time for production without SetUp machine time being pick up to compute finish time. how could we achieve this? only those Machine time will be check.
    thanks

  • Data and time characteristics found in character and keyfigures?

    hi all,
    I can find date and time found in both characteristics and keyfigures. Can anyone tell me in which scenario we shall select date and time considered in characteristics and when shall we select date and time for keyfigures.
    can anyone explain me with an scenario.
    regds
    hari

    Hi,
    date and time will be key figures in the case if you want to do some calculation based on them like subtraction or multiplication ( you can do it i also thorugh formula valriables but it has it's limitation)and they are not going to be used as drilldown or for selection variables in the reports.
    If you want only selection and drilldown on then then you should go for char.
    Thanks

Maybe you are looking for

  • Mapping issue with iphone maps

    Why does the map on my iphone not correctly place my searches in the right spot. 2 times today it was off by a mile, literally a mile, and map quest maps was right on. The map icon on my iphone is useless since they upgraded the software.

  • Which is better for Pro Tools LE-PowerMac G5 Dual-Core 2.3Ghz or Dual 2.7Gh

    I'm starting a small recording studio and I own a PowerMac G5 Dual-Core 2.3Ghz with 2GB of RAM and a PowerMac G5 Dual 2.7Ghz with 2GB of RAM. I need to keep one of them to run Pro Tools LE. Both G5's have the same hard drives and similar graphics car

  • Help with memory issue - abap memory vs roll area

    Hi experts, with our customer we are using TRM and WebDynpro technology to process Tax forms. We have portal integration. Recently due to performance reasons we were forced to analyze memory consumption and actually we are unable to understand what i

  • To find Where-Used of ODS Active table

    Dear Experts, I am having an ODS for which I wish to know wherever the active table is used as reference. It has been used in many places in ABAP routines of transformations. I wish to know wherever the table is included. I checked in SE11 for where

  • When I try to receive my mail a message pops up saying "cannot connect to server" how can i fix this?

    Hi im wondering if anyone can help me! When I try to receive my mail from my account a message pops up and says "cannot connect to server" I have tried things like deleting my account and adding it again, rebooting my Ipad, restoring my Ipad. it has