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

subtracting from date format.

Former Member
0 Likes
571

hi everyone,

my requirement:

DATA : DAT TYPE SY-DATUM.

DAT = SY-DATUM.

I am provided with a data from a table which has a value like 36 months.

DAT is the current date and i want to subtract the value of 36 months from this current date. The result must be again displayed in date format.

Could you please suggest any relevent code.

Thanks in Advance.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
549

show with sample data...Qn not clear....

4 REPLIES 4
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
550

show with sample data...Qn not clear....

Read only

0 Likes
549

lets say that dat is the current date.

dat is 22.02.2008

i am provided with the number 36 months.

now i have to subtract 36 months from dat so that my output will be 22.02.2005.

Read only

0 Likes
549

use fm

CCM_GO_BACK_MONTHS

Provide date and month...u will get the result

Read only

0 Likes
549

Hi,

There is a fm MONTH_PLUS_DETERMINE exactly for your requirement. see the use below


CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months        = 36
    olddate       = <your current date>
 IMPORTING
   NEWDATE       = < your future date>
          .

The result format will be exactly what you have desired.

<REMOVED BY MODERATOR>

Harikrishna.

Edited by: Alvaro Tejada Galindo on Feb 22, 2008 5:09 PM