2007 Jul 18 6:34 AM
Hi,
Is any FM is there which can calculate the previous 1 year date or more.
Suppose I have today's date & based on that date I wanted to calculate the previous 1 year date.
2007 Jul 18 6:38 AM
Try even in this way
data: prev_date like sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = sy-datum
days = 3
months = 0
signum = '-'
years = 0
IMPORTING
calc_date = prev_date.
write:/ prev_date.
2007 Jul 18 6:37 AM
Hi Neha,
No need to go for any FM,
Just use like this
data last_date type d.
last_date0(4) = sy-datum0(4) - 1.
last_date4(4) = sy-datum4(4).
Regards,
Atish
2007 Jul 18 6:37 AM
hi Neha,
Use the following FM for getting the year and the month based on date
CACS_DATE_GET_YEAR_MONTH
Regards,
Santosh
2007 Jul 18 6:38 AM
Try even in this way
data: prev_date like sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = sy-datum
days = 3
months = 0
signum = '-'
years = 0
IMPORTING
calc_date = prev_date.
write:/ prev_date.
2007 Jul 18 6:38 AM
Hi Neha,
here is the function module. Which you can use to get any month date and year.
RP_CALC_DATE_IN_INTERVAL
Hope this will help you out.
Rewards if helpful.
Regards
Azad.
If any query tell me.
2007 Jul 18 6:39 AM
HI,
Start date would be 01 for every month, so to find the last date for a month use RP_LAST_DAY_OF_MONTHS function module
Or
Please try this.
data: wa_date like sy-datum,
s_date like sy-datum,
e_date like sy-datum.
wa_date = sy-datum - 30.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = wa_date
IMPORTING
ev_month_begin_date = s_date
ev_month_end_date = e_date.
<b>Reward points</b>
Regards
2007 Jul 18 6:44 AM
Hi,
<b>DATE_CHECK_PLAUSIBILITY</b>- Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
<b>DATE_COMPUTE_DAY</b>- Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
<b>DATE_GET_WEEK</b> -will return the week that a date is in.
<b>DATE_IN_FUTURE</b>- Calculate a date N days in the future.
<b>DAY_ATTRIBUTES_GET</b> - Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.(provided by Francois Henrotte)
F4_DATE displays a calendar in a popup window and allows user to choose a date, or it can be displayed read only.
Pls find any FM useful to u.
Pls reward helpful points.
Regards,
Ameet
2007 Jul 18 6:45 AM
Hi,
Please check this code and change the number of years or months or days as per your requirement :
data : date type sy-datum, out_date type sy-datum.
date = '20070702'.
CALL FUNCTION 'J_1H_CAL_DATE_IN_INTERVAL'
EXPORTING
date = date
days = '00'
months = '00'
SIGNUM = '-'
years = '01'
IMPORTING
CALC_DATE = out_date.
write 😕 out_date.
Reward points, if helpful,
Sandeep Kaushik
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |