06-28-2006 2:33 PM
Hi,
I want to know if exists a function to convert from weekly date 'ww.yyyy' to the first day of this week: 'yyyymmdd'.
Or if not, just some idea to do it...
Thank's in advance!
Xavi.
06-28-2006 2:39 PM
Hi you could use the FM
For beginning date use yyyy from your field concatenated with 0101
that is yyyy0101
for the duration multiply by ww say (03) by 7 and subtract 7 or ww-1 multiplied by 7.
e.g 032005 would give
begin date 20050101
and duration would be (03-1) *7 = 14
so the field caldd in wa_duration would be equal to 14.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = begin_date
id_operator = '+'
is_duration = wa_duration
IMPORTING
ed_date = date
EXCEPTIONS
conversion_not_specified = 1
conversion_not_possible = 2
OTHERS = 3.
06-28-2006 2:37 PM
Hi
Use FM BWSO_DATE_GET_FIRST_WEEKDAY to get the first day of the week.
Or
FM WEEK_GET_FIRST_DAY:-
e.g input 200602 (YYYYWW)
output 09.01.2006 (DDMMYYYY)
Sameena
06-28-2006 2:39 PM
Hi you could use the FM
For beginning date use yyyy from your field concatenated with 0101
that is yyyy0101
for the duration multiply by ww say (03) by 7 and subtract 7 or ww-1 multiplied by 7.
e.g 032005 would give
begin date 20050101
and duration would be (03-1) *7 = 14
so the field caldd in wa_duration would be equal to 14.
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = begin_date
id_operator = '+'
is_duration = wa_duration
IMPORTING
ed_date = date
EXCEPTIONS
conversion_not_specified = 1
conversion_not_possible = 2
OTHERS = 3.
06-28-2006 2:42 PM
Check this sample program.
report zrich_0001 .
data: monday type sy-datum.
data: sunday type sy-datum.
data: week type scal-week.
call function 'GET_WEEK_INFO_BASED_ON_DATE'
exporting
date = sy-datum
importing
week = week
monday = monday
sunday = sunday.
write:/ 'This week is', week.
write:/ 'Last Monday was', monday.
write:/ 'Next Sunday is', sunday.
Regards,
Rich Heilman
06-28-2006 2:58 PM
Hi Xavier,
Use FM <b>WEEK_GET_FIRST_DAY</b> to get the first day of the week.
This will accept WEEK as YYYYWW and gives DATE as DD.MM.YYYY
DATA V_DATE LIKE SCAL-DATE.
DATA V_WEEK LIKE SCAL-WEEK VALUE '<b>YYYYWW</b>'.
<b>CALL FUNCTION 'WEEK_GET_FIRST_DAY'</b>
EXPORTING
week = V_WEEK
IMPORTING
DATE = V_DATE
EXCEPTIONS
WEEK_INVALID = 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:/ V_DATE. "<b>DD.MM.YYYY</b>
Thanks,
Vinay
06-29-2006 9:05 AM
Hi people!
Finally I used this:
my date was: RV45A-KETDAT type 'wwyyyy' and the function needs the week date like 'yyyyww'.
CONCATENATE RV45A-KETDAT+3(4) RV45A-KETDAT(2) INTO Ex_Week.
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week = Ex_Week
IMPORTING
DATE = Ex_Monday
EXCEPTIONS
WEEK_INVALID = 1
OTHERS = 2.
And the first day of the week is: Ex_Monday.
Thanks to all!
PS: Vinay... I didn't see yours! hehe