Skip to Content
author's profile photo Former Member
Former Member

How to calculate age of an equipment

Dear guys,

i need to calculate the age of an equipment, i have birth date of it and usuing info provider 0equipment for reporting.

How to subtract birth date from today? do i need to write a formula? i guess there is no sy-datum in bex.

Should i do it in the cube in update rule?

thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 07:25 AM

    Hi John,

    You can use any of these function module in routine to calculate the difference between two dates.

    1. HR_HK_DIFF_BT_2_DATES

    2. PARAMETER:p_date1 TYPE dats,

    p_date2 TYPE dats.

    DATA:lv_diff TYPE i.

    CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

    EXPORTING

    i_datum_bis = p_date1

    i_datum_von = p_date2

    IMPORTING

    e_tage = lv_diff

    EXCEPTIONS

    days_method_not_defined = 1

    OTHERS = 2.

    IF sy-subrc = 0.

    WRITE:/ lv_diff.

    ENDIF.[/code]

    3. DAYS_BETWEEN_TWO_DATES

    4. HR_99S_INTERVAL_BETWEEN_DATES

    5. sd_datetime_difference

    Check these links:

    [https://forums.sdn.sap.com/click.jspa?searchID=13080683&messageID=5146361]

    [https://forums.sdn.sap.com/click.jspa?searchID=13080831&messageID=4479989]

    Hope it helps you.

    Regards,

    Yokesh.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 07:44 AM

    Hi John,

    It is better to include a new field called age in the cube write a routine in update rules such that it should calculate SY-DATUM - Birth date.

    If has to be calculate in BEx, I think you should have field consists of sy-datum, so that difference can be calculated using a formula variable SY-DATUM - Birth date..

    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html

    Hope this helps..........

    Rgs,

    I.R.K

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 09:11 AM

    Hi,

    You have to calculate the age of the equipment at the query run time only. To calculate the age on any particular date (At the execution of query), you will need that (current) date. If you do it in the update rules, the age will be calculated at the time of loading the data.

    In BEx you can use User Exit to calculate the age of the equipment dynamically.

    Regards,

    Yogesh.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.