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

Change Year

Former Member
0 Likes
1,074

Hi Experts,

I need a Function module name for the below thing.

If my date is 20070812 then it should minus 1 year and return as 20060812.

If my date is 20050611 then it should minus 2 year and return as 20030611.

I dont need a coding, I need FM for this.Could anyone help?

Points for sure..

Thanks,

Ponraj.s.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,052

Hi Ponraj,

I do not think that any Standard FM will be there.Either you should code it in your program or you can create your own Z FM for your requirement.

Regards,

Mukesh Kumar

Hi Experts,

I need a Function module name for the below thing.

If my date is 20070812 then it should minus 1 year and return as 20060812.

If my date is 20050611 then it should minus 2 year and return as 20030611.

I dont need a coding, I need FM for this.Could anyone help?

Points for sure..

Thanks,

Ponraj.s.

8 REPLIES 8
Read only

Former Member
0 Likes
1,052

Hi Ponraj,

The FM can be searched for if there is any logic for the number of years to be deducted from the dates that you have mentioned above.

What is the logic?

Regards,

Puneet Jhari.

Read only

0 Likes
1,052

Hi Puneet,

Watever date am giving, it should simply minus 1 year from that and returns that date.

wat that FM name???

Read only

Former Member
0 Likes
1,053

Hi Ponraj,

I do not think that any Standard FM will be there.Either you should code it in your program or you can create your own Z FM for your requirement.

Regards,

Mukesh Kumar

Read only

0 Likes
1,052

HI,

you can use FM like 'HR_HCP_ADD_MONTH_TO_DATE'

CALL FUNCTION 'HR_HCP_ADD_MONTH_TO_DATE'

EXPORTING

im_monthcount = '-12' " in months

im_date = lv_date " e.g '10.12.2007'

IMPORTING

EX_DATE = lv_result " result will be 10.12.2006

.

Regards.

Read only

Former Member
0 Likes
1,052

I don't think you will get a FM for such a simple calculation.

There is no need of developing a FM which has such a simple calculation.

Instead you can try to write a simple one liner code for the same.

Regards,

Puneet Jhari.

Read only

Former Member
0 Likes
1,052

Hi,

Use the Function Module : MONTH_PLUS_DETERMINE, Provide inputs months as -12 and olddate as today date.

Hope this info will help you.

Rewards points if useful.

With Regards,

K K V

Read only

Former Member
0 Likes
1,052

Hi,

Use the below code.

DATA: V_DATE LIKE SY-DATUM.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

DATE = '20070812'

DAYS = 0

MONTHS = 0

SIGNUM = '-'

YEARS = '01'

IMPORTING

CALC_DATE = V_DATE.

WRITE:/ V_DATE.

CLEAR V_DATE.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

DATE = '20050611'

DAYS = 0

MONTHS = 0

SIGNUM = '-'

YEARS = '02'

IMPORTING

CALC_DATE = V_DATE.

WRITE:/ V_DATE.

Read only

Former Member
0 Likes
1,052

Resolved..