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

former_member842213
Participant
0 Likes
1,134

hi ,

I want to subtract 13 months from a date.

'OIL_DATE_SUBTRACT_MONTH' this fm is going for dump...

can anybody suggest sme other fn module to do the same.

10 REPLIES 10
Read only

Former Member
0 Likes
1,093

try CALCULATE_DATE

Check this program contributed by Andreas


with month = -13

REPORT zforum117 .


PARAMETERS: date LIKE sy-datum DEFAULT sy-datum,
mth(4) default -1.
DATA: fecha LIKE sy-datum(6),
fecha1 LIKE sy-datum.

CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
* days = '0'
months = mth
start_date = date
IMPORTING
result_date = fecha1.
.


fecha = fecha1(6).

write: fecha.

Read only

Former Member
0 Likes
1,093

try fm

MONTH_PLUS_DETERMINE

regards

shiba dutta

Read only

Former Member
0 Likes
1,093

Well, the easiest thing to do is to simply subsract a number (of days) to a date.

data: w_date like sy-datum.
w_date = sy-datum.
w_date = w_date - 90.
* w_date has a date 90 days of the past.
 
 
But if you have to add or substract months or years, you can use FM RP_CALC_DATE_IN_INTERVAL:
 
data: w_date like sy-datum.
data: new_date like sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL' 
     EXPORTING                           
          DATE      = w_date   
          DAYS      = 0                  
          MONTHS    = 3                  
          SIGNUM    = '-'                
          YEARS     = 0                  
     IMPORTING                           
          CALC_DATE = new_date   
     EXCEPTIONS                          
          OTHERS    = 1.        


* new_date has a value 3 months of the past.

Regards,

Santosh

Read only

former_member508729
Active Participant
0 Likes
1,093

Hi,

Just try to use this FM HRWPC_BL_DATES_MONTH_INTERVAL

here you have to give date and number of month before given date and number of month ahead of given date.

this FM returns the dates subtracting from given date.

Regards

Ashutosh

Reward points if helpful

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,093

Hi,

Use ccm_go_back_months

Read only

Former Member
0 Likes
1,093

Hi,

Use MONTH_PLUS_DETERMINE, and pass -13 for previous date.

+13 for future date.

Regards

Subramanian

Read only

Former Member
0 Likes
1,093

Hi,

Use this

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

  • DAYS = '0'

MONTHS = '-13'

START_DATE = SY-DATUM

IMPORTING

RESULT_DATE = lv_date.

write lv_date.

Rgds,

Prakash

Read only

Former Member
0 Likes
1,093

Hi,

Use this FM

/BEV3/CHCALCULATE_DATE

DATE 12.12.2005

Pass the values like

DAYS 00

MONTHS 13

SIGNUM -

YEARS 0000

KZ_INCL X

Output

CALC_DATE 11.11.2004

Hope this will help u.

Thanks

Shiva

Read only

Former Member
0 Likes
1,093

Hi,

Use the FM:

<b>CALCULATE_DATE</b>

Increase/decrease DATE by a specific number of Days/Months

Hope it helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
1,093

hi,

Use the function module .

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

days = '0'

months = '-13'

start_date = '20061123' " give your start date

IMPORTING

result_date = X.

hope this helps .