Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module or Code Pls...

Former Member
0 Likes
1,093

I will give 2 dates in input. For example 01.01.1973 and 01.09.1974

I need output as 1.8

above 1.8 is (1 year 8 months) for ur understanding...

Friends...need ur help...

--

Raj

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,069

Search in forum...:-)

hrdiffdate - in se37 and check it..

9 REPLIES 9
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,070

Search in forum...:-)

hrdiffdate - in se37 and check it..

Read only

Former Member
0 Likes
1,069

Hi Rajkamal,

See the following code.

REPORT abc.

DATA : d2 TYPE sy-datum.

DATA : days LIKE p0347-scrdd.

PARAMETERS : d1 TYPE sy-datum.

CONCATENATE d1(4) '0101' INTO d2.

CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'

EXPORTING

date1 = d1

date2 = d2

output_format = '02'

IMPORTING

YEARS =

MONTHS =

days = days

EXCEPTIONS

invalid_dates_specified = 1

OTHERS = 2.

WRITE 😕 days.

U CAN USE THIS FUNCTION MODULE ALSO *FIMA_DAYS_AND_MONTHS_AND_YEARS

*

Regards,

Flavya

Read only

Former Member
0 Likes
1,069

hi

try this Fm...

CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = p_begda

end_da = p_stat_date

IMPORTING

  • NO_DAY =

  • NO_MONTH =

  • NO_YEAR =

no_cal_day = p_no_day

EXCEPTIONS

dateint_error = 1

OTHERS = 2

.

Read only

Former Member
0 Likes
1,069

Hi,

check out the following code. It will work.

Data: yr type n,

Month(2) type n.

Diff = date2 u2013 date1.

Yr = diff / 365.

Diff = diff u2013 yr * 365.

Month = diff / 30.

Concatenate yr u2018.u2019 Month to output_string.

thanks,

Kirti.

Read only

Former Member
0 Likes
1,069

Hi,

Check the FM: 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,069

use this FM

FIMA_DAYS_AND_MONTHS_AND_YEARS

u'll get years months and days in seperate variables then u can convert them into ur required format by little application of logic

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,069

Hi,

Use the function module 'HR_HK_DIFF_BT_2_DATES'.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
1,069

done

Read only

0 Likes
1,069

thanks a lot frinds...