2007 Aug 03 7:21 AM
Hi
Actually i had a requirement in which i have to check the amount for every three days.
<b>Example:</b> It has to check for every three consecutive days such as
monday, tuesday, wednesday.......
tuesday,wednesay,thursday
wednesay,thursday,friday
in which i have to omit 2nd and 4th saturdays and also public holidays..
While performing this it has to check If the amount is greater than three crore then it has to fire an mail automatically. Firing an mail if the amount is greater is not a big issue but the problem is how to compare three consecutive days????? how to omit the 2nd & 4th saturdays and also public holidays???
Regards
Krishna
2007 Aug 03 8:37 AM
Hi
Check this sample code
YOu can write your own FM with the following code
TABLES: T001W.
DATA: WORKDAY_FLAG(1) TYPE C.
CLEAR: T001W, RESULT_DATE.
* Check whether base date is required to be included
IF INCLUDE_BASE <> SPACE.
DATUM = DATUM - 1.
ENDIF.
* Get the Factory calender ID if not supplied
IF FABKL IS INITIAL.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
FABKL = T001W-FABKL.
ENDIF.
* Make sure you have atleaset a day for calculation.
IF DAYS = 0.
DAYS = 1.
ENDIF.
WHILE DAYS > 0.
DATUM = DATUM + 1.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = DATUM
FACTORY_CALENDAR_ID = FABKL
IMPORTING
WORKINGDAY_INDICATOR = WORKDAY_FLAG
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
CASE SY-SUBRC.
WHEN 1.
RAISE CALENDAR_BUFFER_NOT_LOADABLE.
WHEN 2.
RAISE CORRECT_OPTION_INVALID.
WHEN 3.
RAISE DATE_AFTER_RANGE.
WHEN 4.
RAISE DATE_BEFORE_RANGE.
WHEN 5.
RAISE DATE_INVALID.
WHEN 6.
RAISE FACTORY_CALENDAR_NOT_FOUND.
ENDCASE.
IF WORKDAY_FLAG IS INITIAL.
DAYS = DAYS - 1.
ENDIF.
ENDWHILE.
RESULT_DATE = DATUM.
Reward all helpfull answers
Regards
Pavan
Message was edited by:
Pavan praveen
Message was edited by:
Pavan praveen
Hi
Actually i had a requirement in which i have to check the amount for every three days.
<b>Example:</b> It has to check for every three consecutive days such as
monday, tuesday, wednesday.......
tuesday,wednesay,thursday
wednesay,thursday,friday
in which i have to omit 2nd and 4th saturdays and also public holidays..
While performing this it has to check If the amount is greater than three crore then it has to fire an mail automatically. Firing an mail if the amount is greater is not a big issue but the problem is how to compare three consecutive days????? how to omit the 2nd & 4th saturdays and also public holidays???
Regards
Krishna
2007 Aug 03 7:40 AM
2007 Aug 03 7:45 AM
2007 Aug 03 7:56 AM
Use the function module HOLIDAY_GET to get the list of holidays.
Use the function modules HOLIDAY_CALENDAR_GET and FACTORY_CALENDAR_GET to get your holiday and factory calendars.
Please mark points if the solution was useful.
Regards,
Manoj
2007 Aug 03 7:58 AM
But how to check for the three consecutive days any coding part plz sample
2007 Aug 03 8:03 AM
Pass the date range you want to check for holidays to the function module HOLIDAY_GET and it will return you the list of holidays between that range in an internal table. Read the table and you will get to know the list of holidays.
Please mark points if the solution was useful.
Regards,
Manoj
2007 Aug 03 8:30 AM
2007 Aug 03 7:54 AM
Hi,
Factory calender has been set in your sap system?
if yese use this function module BKK_CHECK_HOLIDAY.
[<i>b]regards
Debjani
Rewards point for helpful answer</b></i>
2007 Aug 03 8:00 AM
Hi,
create a z table which will store last mail sent date.
check laterst mail sent date.
for saturdays check this link:
u can get holidays with FM HOLIDAY_GET.
then
create a program and fit this logic in that and schedule this program to rum on every day on a particular time . chek all dates and if it meets ur requiremetn send a mail using FM SO_DOCUMENT_SEND_API1
Hope this will help u.
Jogdand M B
2007 Aug 03 8:37 AM
Hi
Check this sample code
YOu can write your own FM with the following code
TABLES: T001W.
DATA: WORKDAY_FLAG(1) TYPE C.
CLEAR: T001W, RESULT_DATE.
* Check whether base date is required to be included
IF INCLUDE_BASE <> SPACE.
DATUM = DATUM - 1.
ENDIF.
* Get the Factory calender ID if not supplied
IF FABKL IS INITIAL.
SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
FABKL = T001W-FABKL.
ENDIF.
* Make sure you have atleaset a day for calculation.
IF DAYS = 0.
DAYS = 1.
ENDIF.
WHILE DAYS > 0.
DATUM = DATUM + 1.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
DATE = DATUM
FACTORY_CALENDAR_ID = FABKL
IMPORTING
WORKINGDAY_INDICATOR = WORKDAY_FLAG
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
CASE SY-SUBRC.
WHEN 1.
RAISE CALENDAR_BUFFER_NOT_LOADABLE.
WHEN 2.
RAISE CORRECT_OPTION_INVALID.
WHEN 3.
RAISE DATE_AFTER_RANGE.
WHEN 4.
RAISE DATE_BEFORE_RANGE.
WHEN 5.
RAISE DATE_INVALID.
WHEN 6.
RAISE FACTORY_CALENDAR_NOT_FOUND.
ENDCASE.
IF WORKDAY_FLAG IS INITIAL.
DAYS = DAYS - 1.
ENDIF.
ENDWHILE.
RESULT_DATE = DATUM.
Reward all helpfull answers
Regards
Pavan
Message was edited by:
Pavan praveen
Message was edited by:
Pavan praveen
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |