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

Regarding date FM

sreeramkumar_madisetty
Active Contributor
0 Likes
1,001

Hi Gurus

my requirement is just simple:

suppose today's date is : 07.03.3007.

I want to subtract 12 months from the current.

So that I have to get 07.03.2006.

Please suggest me any FM available.

Points are guaranteed.

Regards,

kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
964

<b>CCM_GO_BACK_MONTHS</b>


data d1 type sy-datum.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = '12'
IMPORTING
NEWDATE = d1.
write d1.

Message was edited by:

Santosh Kumar Patha

Hi Gurus

my requirement is just simple:

suppose today's date is : 07.03.3007.

I want to subtract 12 months from the current.

So that I have to get 07.03.2006.

Please suggest me any FM available.

Points are guaranteed.

Regards,

kumar

7 REPLIES 7
Read only

Former Member
0 Likes
965

<b>CCM_GO_BACK_MONTHS</b>


data d1 type sy-datum.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = '12'
IMPORTING
NEWDATE = d1.
write d1.

Message was edited by:

Santosh Kumar Patha

Read only

Former Member
0 Likes
964
 CALL FUNCTION 'CCM_GO_BACK_MONTHS'
       EXPORTING
            currdate   = sy-datum
            backmonths = '12'
       IMPORTING
            newdate    = p__audat.
Read only

rahulkavuri
Active Contributor
0 Likes
964

hi i dont think u will get any FM's to do this task

data: temp_dat(10).

data: year(4).

year = temp_dat+5(4).

year = year - 1.

concatenate temp_dat0(2) temp_dat3(2) year into temp_dat separated by '.'.

Read only

Former Member
0 Likes
964

use FM 'CALCULATE_DATE'

u can give negative value in month field..like '-12'.

or u can simply write like this -

p_date = p_date - 12 .

bt for this date shud be of type sy-datum like 20061231.

amit

reward if helpfull

Read only

Former Member
0 Likes
964

Hi ram,

Function module "CCM_GO_BACK_MONTHS" will give you the required format for the date that you want.

Mark all helpful answers

Read only

Former Member
0 Likes
964

FM CCM_GO_BACK_MONTHS will address ur issue.

Read only

Former Member
0 Likes
964

Hai sree ram ...

Here if u want to suntract exactly 12 munths from a date u can do it as:

DATA DATE LIKE SY-DATUM VALUE '20070307'.

SUBTRACT 1 FROM DATE+0(4) .

WRITE / DATE.

or

u can use the function modole 'CCM_GO_BACK_MONTHS'

W_D1 = SY-DATUM.

CALL FUNCTION 'CCM_GO_BACK_MONTHS'

EXPORTING

CURRDATE = W_D1

BACKMONTHS = 12

IMPORTING

NEWDATE = W_D1.

WRITE W_D1.

here w_d1 will get the new date.

Suresh....