2007 Jan 11 6:49 AM
Hi All,
Is there any FM to check for the below requirement,
Here request is the time, I have to
1.cmp the time between two intervals and
2.the day(Whether Holiday).
If a request is made Local time (0TIME) between 10PM to 6AM
If a request is made on a Holiday.
Pts will be awarded.
Regards,
vinoth.
2007 Jan 11 6:52 AM
2007 Jan 11 6:52 AM
2007 Jan 11 6:52 AM
2007 Jan 11 6:54 AM
2007 Jan 11 6:55 AM
HI,
check the fm below for your requirments.
<b>1. SCOV_TIME_DIFF_46B
2. DATE_CHECK_PLAUSIBILITY</b>
2007 Jan 11 6:55 AM
try this
DELTA_TIME_DAY_HOUR
SD_DATETIME_DIFFERENCE
regards
shiba dutta
2007 Jan 11 6:59 AM
try
CCU_TIMESTAMP_DIFFERENCE
FITP_GET_TIME_DIFFERENCE
SCOV_TIME_DIFF
SRET_TIME_DIFF_GET
TIMECALC_DIFF
SD_DATETIME_DIFFERENCE
2007 Jan 11 6:59 AM
hi,
these are some function modules that u could make use of.
<b>
L_MC_TIME_DIFFERENCE
HR_PDC_CALCULATE_TIME_DIFF
SRET_TIME_DIFF_GET
SD_DATETIME_DIFFERENCE</b>
if the answer solves ur problem do reward points.
Regards,
Kiran
2007 Jan 11 7:02 AM
Hi
for first case use
SD_DATETIME_DIFFERENCE
for second one use
BKK_CHECK_HOLIDAY
Thanks
Shiva
2007 Jan 11 7:46 AM
Hi vinoth ..
See u r looking for the time interval to be
checked between the interval 220000 hrs (10 pm
) to 060000hrs ( 6 am ) of next day ..
Then why are you calculating the difference? is
it for a shift timing check ..
to get the diff " but im sure u may not require this ..
data:DATE_FROM LIKE LTAK-BDATU,
DATE_TO LIKE LTAK-BDATU,
TIME_FROM LIKE LTAK-BZEIT,
TIME_TO LIKE LTAK-BZEIT,
DELTA_TIME LIKE MCWMIT-BE_AE,
DELTA_UNIT LIKE MCWMIT-LZEIT.
DATE_FROM = SY-DATUM.
DATE_TO = DATE_FROM + 1.
TIME_FROM = '220000'.
TIME_TO = '060000'.
CALL FUNCTION 'L_MC_TIME_DIFFERENCE'
EXPORTING
date_from = DATE_FROM
date_to = DATE_TO
TIME_FROM = TIME_FROM
TIME_TO = TIME_TO
IMPORTING
DELTA_TIME = DELTA_TIME
DELTA_UNIT = DELTA_UNIT
EXCEPTIONS
FROM_GREATER_TO = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ DELTA_TIME , DELTA_UNIT.
2. to check //If a request is made Local time (0TIME) between 10PM to 6AM
you can use this logic..
DATA : VAL LIKE SY-UZEIT.
VAL = SY-UZEIT. " if u have this
IF VAL BETWEEN TIME_FROM AND '240000' OR
VAL BETWEEN '000000' AND TIME_TO.
WRITE:/ 'IN THE INTERVAL'.
ELSE .
WRITE:/ 'NOT IN THE INTERVAL'.
ENDIF.
3. to check for a holiday ..use this
*CHECK HOLIDAY
data: ld_date like scal-date ,
lc_holiday_cal_id like scal-hcalid ,
ltab_holiday_attributes like thol occurs 0 with header line,
lc_holiday_found like scal-indicator.
ld_date = sy-datum.
lc_holiday_cal_id = 'US'.
CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
EXPORTING
date = ld_date
holiday_calendar_id = lc_holiday_cal_id
WITH_HOLIDAY_ATTRIBUTES = 'X'
IMPORTING
HOLIDAY_FOUND = lc_holiday_found
tables
holiday_attributes = ltab_holiday_attributes
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
HOLIDAY_CALENDAR_ID_MISSING = 5
HOLIDAY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
if sy-subrc = 0 and
lc_holiday_found = 'X'.
write: / ld_date, 'is a holiday'.
else.
write: / ld_date, 'is not a holiday.
endif.
you can calculate the diff if u want to but in my opinion you are looking for the time interval to fall in hte range for this u need to manipulate the logic cause 10pm to 6am is the date cuts twice and u need to take care of that .
execute logic 1 and 2 and see how this can be done to check whether the time was in that interval .
to check the holiday
holiday_calendar_id = lc_holiday_cal_id
make sure that u have this entry for the plant in t006w for calender id or
tfacd table . an entry for the plant and the country has to be there before trying to find holiday.
regards,
vijay