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

Function Module

Former Member
0 Likes
618

Hi,

is there any Function Module to calculate the last ten days of the given date.

i.e if my Input Date is 07.02.2008

then last 10 days of my input date is ?

Ans : 30.01.2008

also i want the Function Modules Related to Date & Months

1 ACCEPTED SOLUTION
Read only

former_member188829
Active Contributor
0 Likes
581

Hi,

Use FM:RP_CALC_DATE_IN_INTERVAL

Check this program..

DATA:DATE1 TYPE SY-DATUM VALUE '20070207'.
DATA:DATE2 TYPE SY-DATUM.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = DATE1
DAYS = 10
MONTHS = 0
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = DATE2.
WRITE:DATE2.

6 REPLIES 6
Read only

Lakshmant1
Active Contributor
0 Likes
581

Hi Sridhar,

Check FM TV_GO_BACK_N_DAYS

Thanks

Lakshman

Read only

Former Member
0 Likes
581

check this out


date = sy-datum. " here pass ur i/p

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date
days = 10   "days to be susbstracted
months = 00
SIGNUM = '-' "add(+) or substract(-)
years = 00
IMPORTING
CALC_DATE = date1. " new date

write:/ 'new date', date1[/code].
 

Edited by: Santosh Kumar Patha on Feb 7, 2008 7:18 PM

Read only

former_member188829
Active Contributor
0 Likes
582

Hi,

Use FM:RP_CALC_DATE_IN_INTERVAL

Check this program..

DATA:DATE1 TYPE SY-DATUM VALUE '20070207'.
DATA:DATE2 TYPE SY-DATUM.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = DATE1
DAYS = 10
MONTHS = 0
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = DATE2.
WRITE:DATE2.

Read only

Former Member
0 Likes
581

hi,

Check dis HR_99S_DATE_ADD_SUB_DURATION

Read only

Former Member
0 Likes
581

Hi,

You can use FM RP_CALC_DATE_IN_INTERVAL.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
581

hi

good

you can write small code like:

DATA : lv_date TYPE sy-datum,

lv_gjahr TYPE gjahr,

lv_years TYPE i.

lv_date = '20071127'.

lv_gjahr = lv_date(4)

lv_years = 5.

lv_gjhar = lv_gjahr + lv_years.

lv_date(4) = lv_gjahr.

thanks

mrutyun^