‎2005 Sep 12 12:05 PM
HI!
IS there any function module existing wherein I give the Date(eg 09/09/2005) and daytext( eg: monday --etc.
The function module should return the date for Monday ( this date should be after 09/09/2005)
eg : date - 09/10/2005 ( mm/dd/yyyy)
daytext - tuesday
the function module should return me the tuesdays date ( 09/13/2005)
‎2005 Sep 12 12:13 PM
Hi,
There is no FM that suits your requirement.
But you can use DATE_COMPUTE_DAY , which will return the weekday of the date . Say 1 For Monday , 2 for Tuesday .
You can use this to get your date of desired Day .
Cheers
‎2005 Sep 12 2:22 PM
Hi ,
try that:
REPORT zforum51 .
PARAMETERS:date LIKE sy-datum DEFAULT '20050909',
day LIKE t246-langt DEFAULT 'Tuesday',
sprsl LIKE t246-sprsl DEFAULT 'EN'.
DATA i .
DATA z TYPE p DECIMALS 0.
SELECT SINGLE wotnr FROM t246 INTO i
WHERE sprsl = sprsl
AND langt = day.
IF sy-subrc <> 0.
MESSAGE e001(00) WITH 'false input'.
ENDIF.
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = date
IMPORTING
wotnr = z.
WHILE i <> z.
ADD 1 TO date.
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = date
IMPORTING
wotnr = z.
ENDWHILE.
WRITE: day, 15 date.Andreas
‎2005 Sep 13 2:07 AM
use this to get the nth day of the week
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = date
IMPORTING
wotnr = z.
Use this to name of the day
CALL FUNCTION 'DAY_NAMES_GET'
EXPORTING
LANGUAGE = SY-LANGU
TABLES
DAY_NAMES = DAY_NAMES
EXCEPTIONS
DAY_NAMES_NOT_FOUND = 1
OTHERS = 2.
Read table DAY_NAMES with key WOTNR = z.
day_name_short_text = DAY_NAMES-KURZT.
day_name_long_text = DAY_NAMES-LANGT.
regards
gv