‎2007 Sep 04 4:54 AM
Hi all,
I want to do arithmetic operations on date type fields..
like i want to add 5 days to current date...like this..
Pleas help me...
& have ur points..
Regards,
pradeep
‎2007 Sep 04 4:59 AM
hi check this code,
data : days type i,fdate type sy-datum, ldate type sy-datum.
fdate = sy-datum. " todays date
ldate = fdate + 2. " add 2 days
days = ldate - fdate. " days will be 2.
do modifications according to ur requirement
‎2007 Sep 04 4:57 AM
Hi,
check the function module:
RP_CALC_DATE_IN_INTERVAL
regards,
Navneeth K.
‎2007 Sep 04 4:58 AM
Pradeep,
Try this function module
DATE_IN_FUTURE ? takes number of days and date - gives future date in user format and system format
K.Kiran.
‎2007 Sep 04 4:59 AM
hi check this code,
data : days type i,fdate type sy-datum, ldate type sy-datum.
fdate = sy-datum. " todays date
ldate = fdate + 2. " add 2 days
days = ldate - fdate. " days will be 2.
do modifications according to ur requirement
‎2007 Sep 04 5:02 AM
Hi Pradeep,
If you want to add 5 working days to current date then you need to convert the date to factory date first passing country id and the date
DATE_CONVERT_TO_FACTORYDATE
then add 5 to the returned number and convert the value to date type using
FACTORYDATE_CONVERT_TO_DATE
Award points if this is helpful.
Regards,
Ravi G
‎2007 Sep 04 5:25 AM
Hi Pradeep...
Find some of the useful date operations here.
Data : v_date1 like sy-datum.
Data : v_date2 like sy-datum.
Data : v_diff type i.
**Assigning date variables
v_date1 = sy-datum.
v_date2 = sy-datum.
**Extract the individual parts of date
v_date1+6(2) = '01' . "set the Day as the First day of the month
write:/ v_date1.
**Adding no of days.
v_date2 = v_date2 + 5.
write: v_date2.
**Subtracting two date fields
v_diff = v_date2 - v_date1.
write:/ v_diff.
Additionally you can find various FMs to process dates.
Some of them can be found in Function group SCAL.
<b>REWARD POINTS IF HELPFUL.</b>