‎2006 Oct 04 12:58 PM
Hello all,
In my selection screen,i should have a start date as input parameter.i should check the start date entered by the user should be only a monday.if it is not monday then it should give a message.
End date should be a seventh day from the date entered.
ie.. Sunday
How can i do it ?
Regards,
Johnn.
‎2006 Oct 04 1:32 PM
Hi John,
DATA:v_date TYPE scal-date,
v_day LIKE scal-indicator.
parameters: p_bdate type begda,p_edate type begda.
AT SELECTION-SCREEN.
v_date = p_bdate.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = v_date
IMPORTING
day = v_day.
IF v_day = '1'.
p_edate = v_date + 6.
ELSE.
MESSAGE e001(zrep) WITH 'enter date is not monday'..
ENDIF.
Tahnks
Eswar
‎2006 Oct 04 1:01 PM
Hello John,
U can use the FM <b>DATE_TO_DAY</b>
I think u can use the AT SELECTION-SCREEN on field event.
If useful reward.
Vasanth
‎2006 Oct 04 1:03 PM
hi,
<b>at selection-screen.</b>
if p_date-low is not initial.
use the FM - > <b>DATE_TO_DAY</b>.
it will export - <b>WEEKDAY</b>
if it is not monday.
show ur error.
endif.
endif.
if p_date-high is not initial.
use the FM - > <b>DATE_TO_DAY</b>.
it will export - <b>WEEKDAY</b>
if it is not sunday.
show ur error.
endif.
endif.
rgds
anver
pls mark if hlped
Message was edited by: Anversha s
‎2006 Oct 04 1:05 PM
Call function 'DAY_IN_WEEK'
exporting
datum = startdate
importing
wotnr = lday.
If lday ne 1.
message it is not monday.
else.
enddate = startdate + 6.
endif.
‎2006 Oct 04 1:06 PM
Hi John,
try this code
REPORT YCHATEST.
PARAMETERS : P_DATE LIKE SY-DATUM DEFAULT SY-DATUM.
DATA : V_DAY TYPE P DECIMALS 2.
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
DATUM = P_DATE
IMPORTING
WOTNR = V_DAY.
IF V_DAY NE 1.
WRITE : 'Not a monday'.
ELSE..
WRITE : 'Monday'.
ENDIF.
‎2006 Oct 04 1:23 PM
Hi,
use FM DATE_TO_DAY
data var1 like DTRESR-WEEKDAY.
at selection-screen.
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
DATE = p_date
IMPORTING
WEEKDAY = var1
.
if not var1 is initial.
if var1 <> 'MONDAY'.
message e000 with 'End date should be a seventh day from the date entered'.
endif.
Regards
amole
‎2006 Oct 04 1:32 PM
Hi john
you can make use of the FM, DATE_COMPUTE_DAY as follows
Let the code be like this.
Parameters: start_dt type sy-datum,
end_dte type sy-datum,
wrk_day type i.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = start_dt
IMPORTING
DAY = wrk_day
.
if wrk_day ne 1. " wrk_day = 1 means monday,,,,,
message.
endif.
now add the logic for end date, I think it will solve your problem.
Thanks and Regards
Antony Thomas
‎2006 Oct 04 1:32 PM
Hi John,
DATA:v_date TYPE scal-date,
v_day LIKE scal-indicator.
parameters: p_bdate type begda,p_edate type begda.
AT SELECTION-SCREEN.
v_date = p_bdate.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = v_date
IMPORTING
day = v_day.
IF v_day = '1'.
p_edate = v_date + 6.
ELSE.
MESSAGE e001(zrep) WITH 'enter date is not monday'..
ENDIF.
Tahnks
Eswar