cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate year in BEX

Former Member
0 Kudos


Dear Friends,

I need to calculate total years of service for an employee at bex level. I have 0entrydate( hire date) as attribute under 0employee.

Total Yrs in service = (0entrydate - sy-datum ) / 365.

in columns i hav creatd Formula1.. but im stuck. pls tell me step by step

Thanks

vasu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Vikram,

1) Create formula variable with processing type as "Replacement Path" and take 0entrydate as reference characteristic for that variable.

2) Create new formula and subtract (0entrydate-Sy-datum)/365.

Regards,

PRK

yasemin_kilinc
Active Contributor
0 Kudos

Hi Vasu,

Just an addition for Praveen's suggestion. While creating the formula variable make sure that you have chosen infoobject with key value and select "date" as dimension from currency/unit type tab. And create another formula variable with customer exit. In the exit set the variable as sy-datum.

Then you can add a formula such as:

NODIM(variable_1 - variable_2) / 365

to find the total years.

Besides that if you are using a standart infoprovider 0PA_C01 it has a keyfigure 0SRVCLENKYF that directly shows the period of work in years.

hope it helps

Regards

Yasemin..

Answers (3)

Answers (3)

Former Member
0 Kudos

Dear All,

I thank you every one for your valuable input and time. Thanks

Former Member
0 Kudos


Hello Friends,

Thankyou all for the input. Its working fine. I have 2 issues now..

1.  ( sy-datum - Date1) / 365 = 29.8737654 -how to round off this value to 29

2.  If my date1 is blank how to handle...

Thanks

Vasu

ccc_ccc
Active Contributor
0 Kudos

Hi Vasu,

1.  ( sy-datum - Date1) / 365 = 29.8737654 -how to round off this value to 29

    For this check any functions under mathematical header in BEx

2.  If my date1 is blank how to handle...

     For this use

    1 Create new formula(FDATE) and use formula like COUNT(Date1)

     2 Now FDATE returns 1 or 0, (1 Means there is date in Date1, if not returns 0.

     3 Create New formula IF FDATE = 1 then only perform your logic.

Regards,

Nanda

Loed
Active Contributor
0 Kudos

Hi Vijay,

For your question 1, refer to Nanda's answer above..I think there is a formula like ROUNDUP or ROUNDDOWN or CEIL or FLOOR..

For question 2, in the formula you have created, just revise it with this equation:

(DATE1 > 0) * ( (sy-datum - date1) / 365 ) + 0

OR

(DATE1 = 0) * 0 + ( (sy-datum - date1) / 365 )

Just choose between the two (2)..That formula will give you ZERO value if date1 is empty..

Regards,

Loed

former_member976
Active Contributor
0 Kudos

Hi,

first convert to char to KF using the formula variable using replacement path senario.

first convert 0entrydate to kf using the formla variable.

after create the new formla under column panel -> 0entrydate - system date)/ 365.

then execute the qeury in RSRT.

please look at the doc

Thanks,

Phani.