Function module for comparing dates and times

Hi,
I have a date and time stamp in one filed for example as below:
20070125183045
(the first 8 are date in YYYYMMDD format, the next 6 is time in HHMMSS format). Now I want to compare this value to another such value in terms of date and time. First I want to compare dates and then times. Do you know any function module that can serve this purpose?
Thanks very much!

You can compare these using the function module DURATION_DETERMINE.  This fuction will give you the difference, and it can be in a view different units, such as the difference in days, months, etc.
Funciton module takes in Start date and time and end date and time.
Regards,
RIch HEilman

Similar Messages

  • Function Module to get Date and Time out of Timestamp

    Hi,
    Source system timestamp field CREATED_TS of Type DEC-15
    BW PSA data in format 20.140.707.105.948
    In DSO, I have created two target InfoObjects; one for Date and one for Time.
    In transformation from PSA to DSO, in field level routine, I want to split timestamp into Date and Time.
    There is a function module CACS_TIMESTAMP_GET_DATE in source system but it is not available in BW. Another function module ADDR_CONVERT_TIMESTAMP_TO_DATE which is available in BW but returns only Date. 
    Does anyone know a function module in BW which takes Timestamp (PSA data in format 20.140.707.105.948) and returns Date and Time.
    Much better would be a FM which take timestamp and also Timezone  and returns Date and Time.
    Thanks
    Ahmad

    Timestamp to date time conversion (with time zone) is built into ABAP. Why use a function module?
    Read the ABAP help on CONVERT.

  • Function module to convert date and time

    Hi ,
    Requirment is i want to create a file in the application server.So the file name should be in the following format.
    0XX-XXXX-YYYYMMDDHH.format.
    in this HH-hours.I need to take current date and time.so is there any function module to convert into this format.If it is not there how to create file name in this format.
    Thanks,
    MR

    REPORT  ZTEST_CONV.
    data:  time_stamp TYPE timestampl.
    GET TIME STAMP FIELD time_stamp.
    You can try with GET TIME STAMP
    But it will be in Different format.

  • How to compare date and time together

    Hi,
    How to compare Date and Time together?
    For example in a database table there are two fields rundate and runtime.  I want to compare these two with perticular date and time in the program.  Like, I want to pull all the records where the records's date and time are less than a perticular date and time in the program.
    Hope the question is clear...
    Thanks.
    Kavita

    Hi Kavita
    There is no as such Date and Time Comparision FM in Standard SAP  But You can define your own like this
    <b>FUNCTION ZAV4_COMPAREDATETIME.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(DATE1) TYPE  DATS
    *"     REFERENCE(TIME1) TYPE  TIMS
    *"     REFERENCE(DATE2) TYPE  DATS
    *"     REFERENCE(TIME2) TYPE  TIMS
    *"  EXPORTING
    *"     VALUE(TWOISMORETOPICAL) TYPE  C
      twoismoretopical = ''.
      if date2 > date1.
        twoismoretopical = 'X'.
      else.
         if date2 = date1 and time2 > time1.
           twoismoretopical = 'X'.
         endif.
      endif.
    ENDFUNCTION.</b>
    Regards
    Mithlesh

  • Function Module to Compare Date within date Range

    Hi All,
            Does anyone know Function Module to Compare Date within date Range...For example i need to find whether 08/02/2006 falls in between 07/15/2006 and 09/15/2006......

    data: datum type sy-datum value '20070802',
          datum_low type sy-datum  value '20070730',
          datum_high type sy-datum value '20070930'.
    If datum between datum_low and datum_high.
    Endif.
    Regards,
    Rich Heilman

  • Function module for calculating planned and actual cost of production order

    Hi ,
    Do we have any standard function module for calculating planned and actual cost for production order?
    i need to implement this in a Z-report.
    Thanks
    Srini

    Hi,
    try below function module
    CRMCO_GET_PLAN_ACTUAL_COSTS
    CO_IH_GET_PLANNED_COSTS_TOTAL
    Regards,
    Sankaran

  • User login report in Active Directory for specific date and time

    I want to get User login report in Active Directory for specific date and time e.g user logged in at15-01-2015 from 8:00am to 4:00pm
    Is any query, script or any tool available?
    Waiting for reply please

    You can identify the last logon date and time using my script here: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-User-bbcdd771
    If you would like to get back in time and see when the user did a logon / logoff then you need to have auditing enabled. Once done, you can records from Security log in the event viewer: https://social.technet.microsoft.com/Forums/windowsserver/en-US/98cbecb0-d23d-479d-aa65-07e3e214e2c7/manage-active-directory-users-logon-logoff-events
    I have started a Wiki about how to track logon / logoff and it can help too: http://social.technet.microsoft.com/wiki/contents/articles/20422.record-logon-logoff-activities-on-domain-servers-and-workstations-using-group-policy.aspx
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • Function Modules for Format Date, Month Name and Quarter value.

    Hi All,
    1. I am getting the date field from the Flatfile, so i need to format the date to YYYYMMDD. Is there any Function module for that in BW.
    2. Based on the above Formated Date i have to find out the Name of the Month like JANUARY, FEBUARY etc.
    3. Based on the same above Formated Date i need to find out the Quarter like 1, 2 etc.
    Could you please let me know if any function modules are there for the above questions in BW not in ABAP, why i mention is some Function modules are there in ABAP but not in BW.
    Thanks in advance.
    Regards,
    srinivas

    Hi ,
    1.If your input date format is MMDDYYYY then Use SDATE as conversion routine in trans strucutre to convert into YYYYMMDD.
    2.By passing year as input parameter for the following FM you would get all the months with text.Using READ statement in routine you can get month name
    MONTH_NAMES_GET
    3.For Quarters you can use the following FM:
    TSTR_PERIODS_QUARTERS
    hope it helps...
    regards,
    Raju

  • Need help in using SQL in a jsp file to compare date and time

    hi every one,
    Actually I am doing a project using JSP. I need to compare a date field in the database (MS Acess) to the current system date and time. I have to do this in a select statement.
    I have alredy defined a variable of type Date in the JSP file and I am comparing this variable to the date in the database through a select statemant.
    Here is what I am doing
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
              java.util.Date today = new java.util.Date();
              String myDate=sdf.format(today);
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= "+myDate+" ;";
    EDate is the feild in the database and it's format is (5/12/2008 5:29:47 PM) it is of type Date/Time in MS Acess.
    when I execute the query it gives the following error
    SQL error:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'EDate <= 2008-10-16 08:10:07'.
    I hope any one can help me with that error and answer my question, I've tried too many things but nothing helps
    Thanks in advance :-)

    Hi,
    When the comparision is needed to be done with the current date , we don't need to send in Java
    Date then format it and compare with MS Acess Date.
    In MS Access we have Date() function which will give you the current date.
    So you can try rewriting your query as following :
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= Date() ;"; ---------------------
    Hope this helps.
    Thanks

  • RFC enabled function module for insert update and delete in a Ztable..

    friends..
    Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)? if not how can we create it? plz give me the details steps..
    what are the import, export parameters and how to develop and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address)
    Thanks and Regards

    Hi,
    Try this code.
    REPORT ZMMC071Z_RMV.
    TYPE-POOLS : ABAP.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>,
                   <DYN_FIELD>,
                   <LV_CONDI>.
    DATA: DY_TABLE TYPE REF TO DATA,
    DY_LINE TYPE REF TO DATA,
    XFC TYPE LVC_S_FCAT,
    IFC TYPE LVC_T_FCAT.
    SELECTION-SCREEN BEGIN OF BLOCK F1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: P_TABLE  LIKE DD02L-TABNAME OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK F1.
    Evento: At Selection Screen                                          *
    START-OF-SELECTION.
      PERFORM GET_STRUCTURE.
      PERFORM CREATE_DYNAMIC_ITAB.
      PERFORM GET_DATA.
    END-OF-SELECTION.
    *& Form get_structure
    text
    FORM GET_STRUCTURE.
      DATA : IDETAILS TYPE ABAP_COMPDESCR_TAB,
      XDETAILS TYPE ABAP_COMPDESCR.
      DATA : REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.
      DATA VL_LENGHT(30).
    Get the structure of the table.
      REF_TABLE_DES ?=
      CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).
      IDETAILS[] = REF_TABLE_DES->COMPONENTS[].
      LOOP AT IDETAILS INTO XDETAILS.
        CLEAR XFC.
        XFC-FIELDNAME = XDETAILS-NAME .
        XFC-DATATYPE = XDETAILS-TYPE_KIND.
        XFC-INTTYPE = XDETAILS-TYPE_KIND.
        XFC-INTLEN = XDETAILS-LENGTH.
        XFC-DECIMALS = XDETAILS-DECIMALS.
        APPEND XFC TO IFC.
      ENDLOOP.
    ENDFORM. "get_structure
    *& Form create_dynamic_itab
    text
    FORM CREATE_DYNAMIC_ITAB.
    Create dynamic internal table and assign to FS
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IFC
        IMPORTING
          EP_TABLE        = DY_TABLE.
      ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    Create dynamic work area and assign to FS
      CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
      ASSIGN DY_LINE->* TO <DYN_WA>.
    ENDFORM. "create_dynamic_itab
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
    *Get data from p_table into internal table <DYN_TABLE>
      SELECT * INTO TABLE <DYN_TABLE>
          FROM (P_TABLE)
    Here you can implemente function DELETE, INSERT.
    ENDFORM.                    " De_para

  • Function Module for Discount Date

    Hi,
         Can somebody tell me whether there is any function module for determining the Discount Date (DATS) and Payment Due Date(DATS) based on Payment Terms (ZTERM)?
    Thanks,
    John.

    FI_FIND_PAYMENT_CONDITIONS
    DETERMINE_DUE_DATE

  • Function that check if date and time between to dates and time

    hi
    is there any function that can check if date and time are between to dates and time ?
    thanks
    Ami

    You can check using IF condition.
    DATA : d1 TYPE datum, d2 TYPE datum, d3 TYPE datum.
    IF d1 BETWEEN d2 AND d3.
      d1 = d1 + 1.
    ENDIF.
    where d1, d2 and d3 are dates.
    Similarly you can check for Time and Timestamp.
    regards,
    Jinson

  • How can I remove all or part of the information in headers and footers? For example, date and time of printing.

    I cannot find where I can suppress the printing of the date and time of printing or if I want a header and/or footer at all.

    If using the traditional menus, in the File menu select Page Setup
    If using the orange Firefox button, click on it, then select Print and then Page Setup
    Once you have the page Setup dialog displayed, go to the "Margins & Header/Footer" tab. You need to change all of the options for header and footer to "--blank--"

  • Function Module for selecting date by day

    Is there any function module to choose date by day. for example if I give today's date the FM should give me next thursday's date.
    Thanks
    Tharani

    this works good........
    *& Report  YCHATEST                                                    *
    REPORT  YCHATEST
    data:day like DTRESR-WEEKDAY.
    parameters:curr_dat like sy-datum default sy-datum.
    CALL FUNCTION 'DATE_TO_DAY'
      EXPORTING
        DATE          = CURR_DAT
    IMPORTING
       WEEKDAY       = day.
    write : / day.
    case day.
    when 'Monday'.
       CURR_DAT = CURR_DAT + 3.
    when 'Tuesday'.
       CURR_DAT = CURR_DAT + 2.
    when 'Wed.'.
       CURR_DAT = CURR_DAT + 1.
    when 'Thursday'.
       CURR_DAT = CURR_DAT + 7.
    when 'Friday'.
       CURR_DAT = CURR_DAT + 6.
    when 'Sat.'.
       CURR_DAT = CURR_DAT + 5.
    when 'Sunday'.
       CURR_DAT = CURR_DAT + 4.
    endcase.
      write :/ CURR_DAT.

  • LSO: Function Module for follow up and inserting qualification

    Hi,
    I have a situation where the employee is booked for a course in SAP, employee will attend the course and the results will come from an external system in a text file. I need to upload this text file and do the follow up for this course with pass or failure. Is there any function module for this scenario ?
    Once I did the follow-up, if there is a qualification attached to the course type, I need to insert the qualification in the employee profile. Is there any function module for this scenario ?
    Your help will be greatly appreciated and I will give the points accordingly.
    Thanks
    Naresh

    LSO_BUFFER_PARTIC_CONFIRMATION
    LSO_UPDATE_FOLLOWUP
    LSO_BUFFER_QUALIS_FOR_TRANSFER
    LSO_UPDATE_FOLLOWUP
    LSO_BUFFER_TRAINING_FOUP
    LSO_UPDATE_FOLLOWUP
    We can use the above FM's to complete the course follow up.

Maybe you are looking for

  • Simple way to insert data from one table

    Hi, I need to know a simple way on how to transfer the data from one table to another.... First table xx_inv_tab1 has three columns col1, col2, col3 and where as second table xx_inv_tab2 has five columns col1, col2, col3, col4, col5. Here col2, col3,

  • HOW TO USE ATTRIBUTE VALUE IN FOX FORMULA LOOP

    HI, IAM SUMMING UP AMOUNT BASED ON BELOW COMBINATION AND THROWING MESSAGE IF AMOUNT IS EXCEEDING OPENPO VALUE....AND IS WORKING FINE...NOW I HAVE A ENHANCE MENT THAT I HAVE TO USE ATTRIBUTE PROFIT CENTER VALUE IN THE LOOP. I HAVE DECLARED THIS --- PC

  • Get first frame of an flv video into a jpg image

    I am creating an app with flex for recording a video and i want to capture the first image of the video recorded, by now i use the following function in order to capture the first image but its rather slow private function capture():void             

  • Photoshop restore opened files workspace suggestion

    Hi, I have a suggestion for a feature that would take a snapshot of all your opened files and placement in photoshop and restore them the next time you restart photoshop. The idea would be if you need to log out everyday or reboot machine, you don't

  • Correlation Collect pattern in  SAP XI

    Hi,    Could some one please clearly and simply explain me about the correlation and collect pattern in BPM. Your help is really appreciate.