on 09-13-2014 1:13 AM
Hi
We're deriving week commencing from date, but I'm not getting correct results as expected.
Please see code below and recommend what change should need to make to get correct result. I've attached below codes and how results should look like and what it is coming now
code: (field level routine)
this is how it should look like:
it
this is what it is coming now,, could please correct me what should change to get above:
Hi Pawan,
Try this field routine code.
DATA: L_WEEK TYPE KWEEK,
L_DATE TYPE SY-DATUM,
F_DATE TYPE SY-DATUM,
DAY_NO TYPE SCAL-INDICATOR.
L_DATE = SOURCE_FIELDS-PRINTDATE.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = L_DATE
IMPORTING
DAY = DAY_NO.
IF DAY_NO EQ 7.
RESULT = L_DATE.
ELSE.
CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
*****Get 1st day of week (Monday Date)
EXPORTING
DATE_IN = L_DATE
IMPORTING
DATE_OUT = F_DATE.
F_DATE = F_DATE - 1.
RESULT = F_DATE.
ENDIF.
Thanks,
Somesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pawan,
you need to add one more condition, if the date is sunday, then populate the same date as print date.
for eg:-
pass the date to the below FM, and if the day is 7 i.e Sunday,
then zWkcom = Zprint_dt
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = w_first_date (pass your print date here)
IMPORTING
day = w_day.
Regards,
Sakthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi pawan,
please explain the requirement about ZWEKCOM and ZPRINT_DT
you want week derived form the ZWEKCOM ?
you want like this
01.01.2014 - Ist week
07.01.2014 - 2nd week
14.01.2014 - 3rd week
Thanks,
Phani.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
we're deriving week commencing from print date.
Week Commencing is from Sunday - Saturday.
E.g. When print date is from 10.08-16.08.2014 then week commencing is 10.08.2014
when print date is from 17.08.2014-- 23.08.2014 then week commencing is 17.08.2014
( in above code when print date is 17.08.2014 it's still picking 10.08.2014
can you provide sample code please??
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.