2006 Aug 02 2:42 PM
Hello guys,
I have a date(07/26/2006) and time (17:07:46)fields.
I have to condition to check if it is crossed two days ( i.e 24 hrs ) how shud i add exactly 2 days (or 24 hrs ) to this this date and time field.
like shud i add 2 days to date? if so how?
or any other solution?
2006 Aug 02 2:44 PM
You can try this FM RP_CALC_DATE_IN_INTERVAL.
(it is workin tested...)
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 3
months = 0
signum = '+'
years = 0
importing
calc_date = wa_date.
Hello guys,
I have a date(07/26/2006) and time (17:07:46)fields.
I have to condition to check if it is crossed two days ( i.e 24 hrs ) how shud i add exactly 2 days (or 24 hrs ) to this this date and time field.
like shud i add 2 days to date? if so how?
or any other solution?
2006 Aug 02 2:44 PM
You can try this FM RP_CALC_DATE_IN_INTERVAL.
(it is workin tested...)
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 3
months = 0
signum = '+'
years = 0
importing
calc_date = wa_date.
2006 Aug 02 2:47 PM
Yes, u can add '2' to the date variable u r having now. That will solve ur problem.
2006 Aug 02 2:55 PM
IF just add 2 to date ...in that case i have to check time...is it same or less or greater.
coz i need exactly 24 hrs added to date and time.....
2006 Aug 02 2:56 PM
2006 Aug 02 3:17 PM
Hi Aday,
If you specically want to add only hours then use this function module <b>CATT_ADD_TO_TIME</b>.
DATA V_DATE TYPE SY-DATUM VALUE '20060726'.
DATA V_TIME TYPE SY-UZEIT VALUE '170746'.
DATA V_DATE1 TYPE SY-DATUM VALUE '20060726'.
DATA V_TIME1 TYPE SY-UZEIT VALUE '170746'.
CALL FUNCTION 'CATT_ADD_TO_TIME'
EXPORTING
idate = V_DATE
itime = V_TIME
stdaz = '2400' -->Specify hours with minutes
IMPORTING
EDATE = V_DATE1
ETIME = V_TIME1.
WRITE:/ V_DATE1, V_TIME1. -->Will contain new date and time afte adding STDAZ hours with mintues.
Thanks,
Vinay
2006 Aug 02 2:52 PM
2006 Aug 02 2:54 PM
Hi Aday,
Just add 2 to date field and check for condition.
DATA V_DATE1 TYPE SY-DATUM VALUE '20062607'.
DATA V_TIME TYPE SY-UZEIT VALUE '170746'.
DATA V_DATE2 TYPE SY-DATUM.
V_DATE2 = V_DATE1 + 2.
IF V_DATE <= V_DATE2 AND V_TIME <= V_TIME1.
WRITE:/ 'DOESNT CROSS 2 DAYS'.
ELSE.
WRITE:/ 'CROSSED 2 DAYS'.
ENDIF.
Thanks,
Vinay
2006 Aug 02 4:08 PM
I have a tbale with some fields.
lets say 3 fields xxx ,date (07/26/2006 )
and time(17:07:46) .
i want to select xxx from table only if it is two days or more older.
that's what i need .
may be i shud have asked question clearly...
2006 Aug 02 4:24 PM
Hi Aday,
Try with this code.
DATA V_DATE TYPE SY-DATUM.
V_DATE = SY-DATUM - 2.
LOOP AT ITAB WHERE DATE >= V_DATE.
WRITE:/ ITAB-XXX.
You have XXX values so now code as per your need here
ENDLOOP.
Thanks,
Vinay
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |