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

Get Previous Year

Former Member
0 Likes
702

Hi Guru,

My functionality is that I have to conver sysdate to 12 months before. means today 12th june 2008.so i have to convert this as 12th june 2007. is there any logic or function module.

Please help me.

5 REPLIES 5
Read only

naimesh_patel
Active Contributor
0 Likes
681

Just do like:

DATA: L_DATE TYPE D.

L_DATE = SY-DATUM.

L_DATE0(4) = L_DATE0(4) - 1.

Regards,

Naimesh Patel

Read only

former_member673464
Active Contributor
0 Likes
681

hi,

you can use the following logic .

w_Date = sy-datum.

w_Date4(4) = w_date4(4) - 1.

regards,

Veeresh

Read only

Former Member
0 Likes
681

Hi Sandeep,

Use function module CCM_GO_BACK_MONTHS and pass 012 to BACKMONTHS importing parameter.

Thanks,

Vinay

Read only

Former Member
0 Likes
681

Hi sndeep,

This will work,

DATA: n TYPE numc3 VALUE 12,
      w_newdate LIKE sy-datum.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
  EXPORTING
    currdate   = sy-datum
    backmonths = n
  IMPORTING
    newdate    = w_newdate.

WRITE: w_newdate.

Regards

Adil

Read only

Former Member
0 Likes
681

Hi

Look the FM CALCULATE_DATE.


data: date type d.

CALL FUNCTION 'CALCULATE_DATE'
 EXPORTING
*   DAYS              = '0'
   MONTHS            = '-12'
   START_DATE        = SY-DATUM
 IMPORTING
   RESULT_DATE       = date.

Regards

Gregory