‎2006 Dec 13 6:09 PM
hi folks,
g_startdate like sy-datum
g_enddate like sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = g_startdate
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = g_enddate.
I am trying to get the previous day of the startdate using this FM and I am unable to get that.
can anyone tell me what am I doing wrong here?
Thanks
Vinu
‎2006 Dec 14 11:27 AM
Hi Vinu,
a lot of answers for your thread.
Does no answer solve your problem?
Regards, Dieter
‎2006 Dec 13 6:16 PM
Working fine for me.
report zrich_0001.
data: g_startdate type sy-datum,
g_enddate type sy-datum.
g_startdate = sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = g_startdate
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = g_enddate.
write:/ g_enddate.
Regards,
Rich Heilman
‎2006 Dec 13 6:16 PM
hi vinu,
it does work for me.
DATA:G_STArtdate like sy-datum,
g_enddate like sy-datum.
G_STARTDATE = SY-DATUM.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = g_startdate
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = g_enddate.
WRITE: G_ENDDATE.
‎2006 Dec 13 6:31 PM
Hi vinu,
you can try this:
data: g_startdate like sy-datum.
data: g_enddate like sy-datum.
g_startdate = sy-datum.
g_enddate = g_startdate - 1.
write: / g_startdate, g_enddate.
g_startdate = sy-datum.
g_enddate = g_startdate + 1.
write: / g_startdate, g_enddate.
You don't need an FM.
Regards, Dieter
‎2006 Dec 13 6:58 PM
I know it is simple
here is what i wrote in the code...
g_startdate = itab-begda.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting =
date = g_startdate
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = g_enddate.
I do get the start date as 11122006 in the field but g_enddate is 00000000.
I am wondering what am I missing?
Thanks
Vinu
‎2006 Dec 14 7:55 AM
Hi Vinu,
your moving is wrong.
try this:
data: g_startdate like sy-datum.
data: g_enddate like sy-datum.
g_startdate = '20061112'.
g_enddate = g_startdate - 1.
write: / g_startdate, g_enddate.
g_startdate = '20061112'.
g_enddate = g_startdate + 1.
write: / g_startdate, g_enddate.
Regards, Dieter
‎2006 Dec 14 8:19 AM
Hi Vinu,
your moving is wrong.
try this:
data: g_startdate like sy-datum.
data: g_enddate like sy-datum.
g_startdate = '20061112'.
g_enddate = g_startdate - 1.
write: / g_startdate, g_enddate.
g_startdate = '20061112'.
g_enddate = g_startdate + 1.
write: / g_startdate, g_enddate.
Regards, Dieter
‎2006 Dec 14 8:28 AM
Hi Vinu,
The system date format is always "YYYYMMDD". but in your case, you are using "ddmmyyyy". I guess that that is why you are getting 0's. Try this out.
Regards
Raghav
‎2006 Dec 14 8:34 AM
dear if you want use like that format convert your date with follows
DATA: V_DATE LIKE SY-DATUM,
V_DATE2(10).
CALL FUNCTION 'CONVERT_DATE_INPUT'
EXPORTING
INPUT = '21102002' "DD.MM.YYYY
PLAUSIBILITY_CHECK = 'X'
IMPORTING
OUTPUT = V_DATE "YYYY.MM.DD
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
WRONG_FORMAT_IN_INPUT = 2
OTHERS = 3.
V_DATE2 = V_DATE.
WRITE:/ V_DATE2.
‎2006 Dec 13 6:48 PM
Hi Vinu,
Perhaps field G_STARTDATE is empty.
Try to assign SY-DATUM to field G_STARTDATE.
G_STARTDATE = SY-DATUM.
Regards,
Ferry Lianto
‎2006 Dec 13 6:54 PM
Hi Vinu .
Why do you want to use a FM just ti get the previous date .
Just substract from the current date , you will get the result.
Data : v_one type sy-datum.
start-of-selection.
v_one = sy-datum.
write:/ v_one.
v_one = v_one - 1 .
write:/ v_one.
Regards
Arun
‎2006 Dec 14 8:39 AM
execute this code
data : begin of itab occurs 0,
begda like sy-datum,
preda like sy-datum,
end of itab.
ata : g_startdate like sy-datum,
g_enddate like sy-datum.
itab-begda = sy-datum.
append itab.
loop at itab.
g_startdate = itab-begda.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = g_startdate
days = 01
months = 00
SIGNUM = '-'
years = 00
IMPORTING
CALC_DATE = g_enddate.
endloop.
write:/ 'prev date', g_enddate.regards,
vijay.
‎2006 Dec 14 11:23 AM
Hi Vinu,
You may be forgot to assign the date to g_startdate.Please try with the following code:
g_startdate like sy-datum
g_enddate like sy-datum.
g_startdate = sy-datum. "Assigns the current date
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = g_startdate
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = g_enddate.
Hope, you will get the desired result.
‎2006 Dec 14 11:27 AM
Hi Vinu,
a lot of answers for your thread.
Does no answer solve your problem?
Regards, Dieter
‎2006 Dec 14 11:35 AM
‎2006 Dec 14 11:39 AM
Hi Vinu,
Please drop the previous reply as I haven't seen the reply made by you.
The actual problem is in the date format for itab-begda.You need to change it into internal format and the function module can be used for that.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
DATUM = itab-begda.
DTYPE = 'DATS'
IMPORTING
ERROR =
IDATE = g_startdate
MESSG =
MSGLN =
Please check it & revert if any.
Regards,
Selvakumar K.
‎2006 Dec 15 4:51 PM
Appreciaste your help guys. Thanks I shall award the points accordingly.
Vinu