‎2008 May 16 10:14 AM
HI
if i want that what every date i have ......
what is the syntax to get the date which is exactly six month before the given date
like if i have date
15/7/2007
want date 15/1/2007
regards
Nutan
‎2008 May 16 10:16 AM
Hi,
Use the FM:RP_CALC_DATE_IN_INTERVAL
DATA:date1 TYPE d VALUE '20080606'.
DATA:date2 TYPE d.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date1
days = '00'
months = '06'
signum = '-'
years = '00'
IMPORTING
calc_date = date2.
WRITE:date2.In Your Case see the Below Program.
DATA:date(10) TYPE c VALUE '15/07/2007'.
DATA:date_output(10) TYPE c.
DATA:date1 TYPE d.
CONCATENATE date+6(4) date+3(2) date+0(2) INTO date1.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date1
days = '00'
months = '06'
signum = '-'
years = '00'
IMPORTING
calc_date = date1.
CONCATENATE date1+6(2) '/' date1+4(2) '/' date1+0(4) INTO date_output.
WRITE:/ date_output.
‎2008 May 16 10:16 AM
Hi,
Use the FM:RP_CALC_DATE_IN_INTERVAL
DATA:date1 TYPE d VALUE '20080606'.
DATA:date2 TYPE d.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date1
days = '00'
months = '06'
signum = '-'
years = '00'
IMPORTING
calc_date = date2.
WRITE:date2.In Your Case see the Below Program.
DATA:date(10) TYPE c VALUE '15/07/2007'.
DATA:date_output(10) TYPE c.
DATA:date1 TYPE d.
CONCATENATE date+6(4) date+3(2) date+0(2) INTO date1.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date1
days = '00'
months = '06'
signum = '-'
years = '00'
IMPORTING
calc_date = date1.
CONCATENATE date1+6(2) '/' date1+4(2) '/' date1+0(4) INTO date_output.
WRITE:/ date_output.
‎2008 May 16 10:18 AM
Hi,
U can do it with the following function module.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date =
days =
months =
SIGNUM = '+'
years =
IMPORTING
CALC_DATE =
.
‎2008 May 16 10:20 AM
In sap system date is in the format of YYYYMMDD
so do calulations in same pattern.
Eg: date1 = sy-datum - '00000600'
here date1 is variable storing the value six month before.
‎2008 May 16 10:20 AM
‎2008 May 16 10:27 AM
Hi
Try this -
DATA: date type d VALUE '15.07.2008',
date_check type d.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date
days = '00'
months = '06'
signum = '-'
years = '00'
IMPORTING
calc_date = date_check.
Hope this helps
regds
Seema
‎2008 May 16 10:28 AM
Hi, use following FM,
ur inp_date is 15/07/2007, u vl get oup_date as 15.01.2007.
ur inp_date value should be 20070715.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = inp_date
backmonths = '006'
IMPORTING
newdate = oup_date.
reward pts if it helps............
‎2008 May 16 10:37 AM
Hi,
Have a look on the following function module.
Through this function module you can get the date either before/after the current month date
data: var1 type sy-datum.
CALL FUNCTION 'HR_PT_ADD_MONTH_TO_DATE'
EXPORTING
dmm_datin = sy-datum
dmm_count = '6'
dmm_oper = '-' " Operation (add/subtract)
dmm_pos = 'B' " Set date in the beginning or end of month
IMPORTING
DMM_DAOUT = VAR1
EXCEPTIONS
UNKNOWN = 1
OTHERS = 2.
write:/ sy-datum.
write:/ var1.
Reward,if useful.
Thanks,
Chandu
‎2008 May 16 10:41 AM
Hi.......
Try to use the Function Module CCM_GO_BACK_MONTHS.
Thanks.
‎2008 May 16 10:41 AM
Hi use FM RP_CALC_DATE_IN_INTERVAL
Add or subtrct interval to a date.
Other useful FMs related to date are :
HR_JP_MONTH_BEGIN_END_DATE
First Date and Last date of the month
HR_IN_GET_DATE_COMPONENTS
Gets the components of a date
FIRST_AND_LAST_DAY_IN_YEAR_GET
Get First Date and Last Date of a year
HR_SGPBS_YRS_MTHS_DAYS
Find the difference between two days
Please assign points if helpful