on 06-19-2008 7:59 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.