To Calculate age in years

Hi Experts,
                    I need to calculate the age in years. I have the date of birth already in my infoprovider that  iam using for my query.
The user will be entering the date on which he want to calculate the age in the selection screen and the date will be stored in a variable..
Now how to calculate the age in years and display it as a separate coloumn in the report?
Regards,
Khan

Hi,
Here 1st create the one formula variable on birth date
then create one more formul variable customer exit varaible with user entry here u cna use the i_step = 2 there user enters which ever that date based on that date it executes
in CKF: this  customer exit user entry varible - birth date formula varible
whenever the user enters date based on that now u r getting  days of the employe AGe
now that CKF can be used in another CKF  by using age/365
now in report u can keep only second CKF.
Thanks & Regards,
Sathish

Similar Messages

  • How to calculate Age in BEx query

    Hi,
    I need to calculate age in years based on person's date of birth and the key date that user of the report will enter.
    So, basically in my query I already have date of birth characteristic from 0PERSON InfoObject. I created ZAGE key figure and added it to the query that I would like to populate with person's age.
    So I know I have to enter some code in CMOD for calculated key figure ZAGE to get calculated based on birthdate and key date that user enters. Can somebody help with the code?
    thanks

    Hi,
    The variable should be in "Date" dimension. I have missed one important information in earlier mail.
    The processing type of the variable (user entry date) should be of "Customer Exit' and dimension (in last tab) should be "Date".
    By selecting this dimension, the variable input help screen also appears in calendar format to help user to select date instead of writing it in variable input.
    No need to write any custom code for this variable. We are selecting the "Customer exit" processing type to get Date dimension. In Normal user entry variables we can't get date & time dimension.
    "Ready for Input" should be selected so that user can enter date.
    I hope you can solve your issue now.
    Thanks for your feedback.
    Regards,
    Arun Thangaraj.
    Edited by: Arun  Thangaraj on Oct 8, 2008 8:48 AM

  • ABAP-HR MODULE(HOW TO CALCULATE AGE & YEARS OF SERVICE)

    HI,
    HOW TO CALCULATE AGE & YEARS OF SERVICE means for example
    I AM USING PNPCE LDB.
    (1) whose age is greater than 52.833 years with 7.833 years of service, with annual rate of pay $170,000 or more, or
    (2) age plus employment service is 65 or more, with annual rate of pay of $ 170,000 or more.
    Note that the $ 170,000 parameter would be a variable that could change annually when this report would be generated. In the past, age and service value were determined as of the run date. The determination date would also be a variable that would change when the report would be generated.
    Thanks&Regards
    Rahul.

    Hi Rahul,
    This is the 2nd warning !!! Please... use the correct or most appropriate forum.
    The ABAP Objects Forum should be used for: ABAP Object definition and implementation including encapsulation, interfaces and inheritance in ABAP Objects.
    This thread will be moved from to .
    You're asking this question in two thread, so the duplicated thread will be deleted.
    Please have a look at [Forum Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] before posting.
    Also read this thread Welcome and Rules of Engagement.
    Greetings,
    Marcelo Ramos

  • Function Module to calculate age

    Hi Abapers,
    Kindly suggest some function module which can calculate age of a person by taking date of birth till date.
    Thanks in advance,
    Radhika

    Hi Radhika,
    Check this program
    REPORT ZTEST.
    DATA : BIRTH_DATE LIKE SY-DATUM,
           DAYS TYPE NUM2,
           MONTHS TYPE NUM2,
           YEARS TYPE NUM2.
    BIRTH_DATE = '19830307'.
    CALL FUNCTION 'HRCM_TIME_PERIOD_CALCULATE'
      EXPORTING
        BEGDA         = BIRTH_DATE
        ENDDA         = SY-DATUM
      IMPORTING
        NOYRS         = YEARS
        NOMNS         = MONTHS
        NODYS         = DAYS
      EXCEPTIONS
        INVALID_DATES = 1
        OVERFLOW      = 2
        OTHERS        = 3.
    WRITE : / YEARS , 'years' , MONTHS , 'months' , DAYS , 'days'.
    Regards,
    Satish

  • How to calculate age in SQL?

    I have a table with DATE as one of the column.
    How do I calculate age?
    Thanks in advance
    -Shilpa

    michaels2 wrote:
    TryWell it still leaves leap year question open. If person was born on February 29, how old is that person on February 28 of a non-leap year? Your code considers it imcomplete year:
    SQL> var dob varchar2(20)
    SQL> exec :dob := '19960229';
    PL/SQL procedure successfully completed.
    SQL> select trunc ( (to_number (to_char (to_date('20090228','yyyymmdd'), 'yyyymmdd'))
      2                  - to_number (to_char(to_date(:dob, 'yyyymmdd'),'yyyymmdd'))
      3                  )
      4                / 10000)
      5            as "Age of Child"
      6    from dual
      7  /
    Age of Child
              12SY.

  • How to calculate age in oracle

    Hi,
    T was trying do calculate age as on todays date in ORACLE but after a lot of brain storming i didn't get it.
    Kindly tell me how to calculate age as in years month days.
    For ex.. My DOB- 02-feb-1984 so my age should get as 27 Years 2 months 8 days
    How to do it.
    I tried this
    select
    TRUNC( months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') )/12 ) Year,
    TRUNC( mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) ) Month,
    mod(months_between( sysdate, TO_DATE('02-02-1984','DD-MM-YYYY') ),12) /30 Days
    from dual
    but days are not calculating correctly...
    RGds,
    PC

    sorry..i didn't chck your query..it is right but give wrong answer..
    WITH got_months AS
         SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
         ,     FLOOR (MONTHS_BETWEEN (SYSDATE, TO_DATE('02-02-1984','DD-MM-YYYY')))     AS months
         FROM     dual
    SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
    ,     TO_CHAR (FLOOR (months / 12))     || ' years, '     ||
         TO_CHAR (MOD (months, 12))      || ' months, '     ||
         TO_CHAR ( CEIL ( SYSDATE
              - ADD_MONTHS ( TO_DATE('02-02-1984','DD-MM-YYYY')
                        , months
              )               || ' days'
    FROM got_months
    o/p
         TO_DATE('02-02-1984','DD-MM-YY     TO_CHAR(FLOOR(MONTHS/12))||'YE
    1     2/2/1984     27 years, 7 months, 9 days
    1 day more..1     it sud be.. 2/2/1984     27 years, 7 months, 8 days
    if i make correction with add_months like below..
    WITH got_months AS
         SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
         ,     FLOOR (MONTHS_BETWEEN (SYSDATE, TO_DATE('02-02-1984','DD-MM-YYYY')))     AS months
         FROM     dual
    SELECT     TO_DATE('02-02-1984','DD-MM-YYYY')
    ,     TO_CHAR (FLOOR (months / 12))     || ' years, '     ||
         TO_CHAR (MOD (months, 12))      || ' months, '     ||
         TO_CHAR ( CEIL ( SYSDATE
              - ADD_MONTHS ( TO_DATE('02-02-1984','DD-MM-YYYY')
                        , months
                        )-1
              )               || ' days'
    FROM got_months
    then o/p is..
         TO_DATE('02-02-1984','DD-MM-YY     TO_CHAR(FLOOR(MONTHS/12))||'YE
    1     2/2/1984     27 years, 7 months, 8 days
    correct but cdnt understand why sud -1?

  • Calculate age in oracle 11g

    how do i calculate age based on date picker in another field on the same table/

    Are you sure of that algorithm?
    orclz> SELECT Round((SYSDATE-to_date('01-JAN-1989','dd-MON-yyyy'))/365) FROM DUAL;
    ROUND((SYSDATE-TO_DATE('01-JAN-1989','DD-MON-YYYY'))/365)
                                                           25
    orclz> SELECT Round((SYSDATE-to_date('01-DEC-1989','dd-MON-yyyy'))/365) FROM DUAL;
    ROUND((SYSDATE-TO_DATE('01-DEC-1989','DD-MON-YYYY'))/365)
                                                           24
    How about this:
    orclz> select extract (year from sysdate) - extract( year from to_date('01-DEC-1989','dd-MON-yyyy')) from dual;
    EXTRACT(YEARFROMSYSDATE)-EXTRACT(YEARFROMTO_DATE('01-DEC-1989','DD-MON-YYYY'))
                                                                                24
    orclz> select extract (year from sysdate) - extract( year from to_date('01-JAN-1989','dd-MON-yyyy')) from dual;
    EXTRACT(YEARFROMSYSDATE)-EXTRACT(YEARFROMTO_DATE('01-JAN-1989','DD-MON-YYYY'))
                                                                                24
    orclz>

  • Calculate age in adf

    Gurus,
    Any inbuilt way to calculate age in adf in year, month format ?
    thnks

    Its not perfect, but in the SummitADF application I calculate a time to ship as
    public oracle.jbo.domain.Number calculateTimeToShip(Date ordered,
    Date shipped) {
    if (null != shipped) {
    long days =
    (shipped.getTime() - ordered.getTime()) / (1000 * 60 * 60 *
    24);
    return new Number(days);
    } else
    return new Number(0);
    You can ammend this to work off of the current date.
    Also a quick google shows loads of examples
    e.g.
    http://www.exampledepot.com/egs/java.util/GetAge.html

  • Query to calculate age

    Hi
    Please suggest me to wirte a function which can calculate age.

    Hi,
    No need of function. Just simple calculation.
    SQL> select round(months_between(sysdate,to_date('11-MAY-1977','dd-MON-YY'))/12) age from dual;
           AGE
            33If you are taking in account the dates stored in a date column of oracle table then do take care of the years
    before and after 1950.
    A thread for your reference: Re: date airthmetic

  • CALCULATE AGE.PLEASE HELP!!!!!

    Hello,
    I am useing oracle 9i and I have got a table clients where i store the the date of brithe in fomat dd-mm-yyyy,
    from that i want to claculate the exact age in format of dd-mm-yyy of the client.
    Could some one please let me know how to do this thing. I can only calculate it in years which is not really usefull for me:(((
    Every help apreciated.

    Hi,
    You can use some select like this.
    select trunc(months_between(sysdate,DOB)/12) "YYYY", trunc(mod(months_between(sysdate,DOB),12)) "MM",
    trunc((mod(months_between(sysdate,DOB),12)- trunc(mod(months_between(sysdate,DOB),12)))*30) "DD" from dual
    There may be better ways

  • Query optmization age in year

    Hey there,
    I calculate the year difference between two dates by doing the following thing :
    TRUNC(MONTHS_BETWEEN(RES.SAMPLE_SAMPLING_DATE,RES.PATIENT_BIRTHDATE)/12)+1Do you think that I can optimized this query or do you know any other ways to do the same calculation ?
    Regards,
    Jarod.

    I didn't find my happiness in previous topic forum, mostly, difference between two dates in hours or minutes. Have a look here: https://forums.oracle.com/forums/search.jspa?threadID=&q=age+calculate+leap+years&objID=f75&dateRange=all&userID=&numResults=15
    Actually, I just want to know if you think if my query is sufficiently optimized.It is a common way to calculate age, seen it more than once. You'll have to run tests on your specific configuration to see what could be improved, but I wouldn't spend hours on that.

  • Cannot find  the age in years csv file  in  the application server

    Hi,
      I want to upload the age in years hierarchy from the CSV  file AGE_E.CSV that should be available in the application server.
      When i try to preview file in the info package, a message is thrown which says that the file does not exist, which means that the perticular file is not present in the application server.
      Can any one of you please tell me where else can i find this file.
    Regards,
    Chetana.

    dear Chetana,
    transaction AL11 can be used to check the file location.
    check DIR_TEMP or DIR_TRANS. or ask basis where the file is put.
    hope this helps.

  • FM to calculate date month & year six months previous to the current date

    Hi All,
    Is there any function module or code to calculate date month & year six months previous to the current date.
    Thanks in advance.

    hi,
    try this
      data : date1 like vbak-erdat.
    data : q type numc3.
    selection-screen : begin of block blk2 with frame title text-001.
    parameters : n like q.
    selection-screen : end of block blk2.
    if n > 0.
    CALL FUNCTION 'CCM_GO_BACK_MONTHS'
             EXPORTING
               CURRDATE         = sy-datum
               BACKMONTHS       = n
           IMPORTING
              NEWDATE          = date1
    selection-screen: begin of block blk1 with frame title text-001.
    select-options :  s_date for vbak-erdat default 'NEWDATE'  to 'sy-datum' no-display.
    selection-screen : end of block blk1.
    write : date1.
    Reward with points if helpful.

  • How to Calculate AGE by getting difference between two Date Fields

    HI Gems
    I need to calculate AGE from getting difference from two date fields. But when i am trying to wrte fromula as Current date - date1(some date field) then it is showing error.
    How can i get values.
    Thanks
    Manu

    You already asked this question:
    How to calculate AGE from two different date fields

  • How to calculate AGE from two different date fields

    hi
    I need to calculate AGE from two different date fields.
    Can some help me how to do, when i try to do substraction formula it is showing error.
    Thank You
    Manu

    Manu wrote:
    Hi
    Both fields are in date format only, i need to calculate no . of days between two different dates
    Thanks
    ManuThe reason for the question about the format of the column is because the simplest solution only works on DATE columns. Others have mentioned this here, but if you want the difference between two date fields, you can use this formula:
    TIMESTAMPDIFF(SQL_TSI_DAY, date_column1, date_column2)
    The above being said, you still didn't tell me what you did, or what error message you received. So again, if the above formula didn't work, what did you do? Where did you put the formula? What was the exact syntax you used? What was the error message you got?
    Please don't make us work more than we need to. Answer all the questions in your next post. Thanks.

Maybe you are looking for

  • HP Envy 5530 not printing in color

    Hello, I have reinstalled the printer drivers.  I have cleaned the printer heads.  Both ink cartridges are full.  However, every time I try to print something from the internet, the preview comes up in black and white.  When I export the image to a p

  • Multiple instances of ECM 11g on one server

    I've read a few posts about installing multiple instances of ECM 11g on one server, but I have a few questions. My current set up is A single Windows 2008 Server R2 server 8 gb RAM Weblogic 10.3.5 1 install of ECM 11g in the base_domain Database is O

  • Problem during Database Creation of 8.1.7 in Linux7.2

    hello folks, i am having a problem in creating database of 8.1.7 in Linux7.2 RedHat. after successful installation,,and after even successfull listener configuration,, when database creation assistant is creating database; On 82% At "Initializing dat

  • Time machine backup from 1TB iMac to 512GB MacBook Pro

    Hi all, I sold my iMac now a few months ago and been hanging out for the new one, but just about to be pursuaded to buy a 512GB MacBook Pro. My only problem is that we did a Time Machine back up on the old computer, and afraid I won't be able to acce

  • How do I copy music files in Apple Lossless format on to a flash drive so I can play on a digital media player.

    I have an iMac 21", running on OS X Yosemite 10.10.2, processor is 2.7GHz Intel Core i%, Memory 8GB 1333MHz. I would like to copy some of my iTunes music in Apple Lossless or AIFF to a flash drive which I would like to insert into a digital media pla