‎2008 Mar 06 11:37 AM
Could you please tell me the logic to validate the date..? In the selection screen
if the user inputs the from date from I quarter it should restrict the user put the end date as 31.03.2008
n if it is under II quarter it should restrict to put the end date as 30.06.2008... respectively for other quarters..
‎2008 Mar 07 10:47 AM
the following logic will certainly help you
AT SELECTION-SCREEN ON s_date.
IF s_date-low+0(4) <> s_date-high+0(4).
MESSAGE e000(vz) WITH text-e01.
ENDIF.
IF s_date-low+4(2) <= '3' AND s_date-high+4(4) <> '0331'.
CONCATENATE s_date-low+0(4) '03' '31' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '3' AND s_date-low+4(2) <= '6' )
AND s_date-high+4(4) <> '0630'.
CONCATENATE s_date-low+0(4) '06' '30' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '6' AND s_date-low+4(2) <= '9' )
AND s_date-high+4(4) <> '0930'.
CONCATENATE s_date-low+0(4) '09' '30' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '9' AND s_date-low+4(2) <= '12' )
AND s_date-high+4(4) <> '1231'.
CONCATENATE s_date-low+0(4) '12' '31' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ENDIF.
‎2008 Mar 06 11:46 AM
Hi try following logic..
parametere :pa_date like sy-datum
at selection-screen on pa_date.
mm = pa_date+4(2). "get month from date
yy = pa_date+6(4).
concatenate 31 03 yy into lw_q1.
concatenate 30 06 yy into lw_q1.
concatenate 30 09 yy into lw_q1.
concatenate 31 12 yy into lw_q1.
CAse MM
when '01'
lw_date = lw_q1.
when '02'
lw_date = lw_q1.
when '03'
lw_date = lw_q1.
when '04'
lw_date = lw_q2.
when '05'
lw_date = lw_q2.
when '06'
lw_date = lw_q2.
when '07'
lw_date = lw_q3.
when '08'
lw_date = lw_q3.
when '09'
lw_date = lw_q3.
when '10'
lw_date = lw_q4.
when '11'
lw_date = lw_q4.
when '12'
lw_date = lw_q4.
endcase.
pa_date =lw_date.
reward points if useful
Regards
Sukhi
‎2008 Mar 06 11:52 AM
HI,
Do like this.
CONCATENATE sy-datum+0(4) '03' '31' INTO l_q1high.
CONCATENATE sy-datum+0(4) '06' '30' INTO l_q2high.
CONCATENATE sy-datum+0(4) '09' '30' INTO l_q3high.
CONCATENATE sy-datum+0(4) '12' '31' INTO l_q4high.
AT SELECTION-SCREEN.
IF so_period-low+4(2) LE 3.
IF so_period-high GT l_q1high.
MESSAGE
ENDIF.
ELSEIF so_period-low+4(2) LE 6.
IF so_period-high GT l_q2high.
MESSAGE
ENDIF.
ELSEIF so_period-low+4(2) LE 9.
IF so_period-high GT l_q3high.
MESSAGE
ENDIF.
ELSE.
IF so_period-high GT l_q4high.
MESSAGE
ENDIF.
ENDIF.
Thanks,
Vinod.
‎2008 Mar 06 11:54 AM
Use this FM - BKK_GET_QUARTER_DATE to get the Quarter End date.
Validate the same across the I/P date.
Regards
Vinayak
‎2008 Mar 06 12:16 PM
Hi,
Check this code. Hope it will be helpful.
select-options s_date type sy-datum.
data: month(2) type c,
month_high(2) type c,
year(4) type c,
year_high(4) type c.
at selection-screen on s_date.
month = s_date-low + 4(2).
year = s_date-low +6(4).
at selection-screen output.
loop at screen.
if screen-name = 'S_DATE-HIGH'.
month_high = s_date-high + 4(2).
year_high = s_date-high + 6(4).
if month = 01 or month = 02 or month = 03.
if month_high > 03 or year_high <> year.
-
give error message.
endif.
endif.
If month = 04 or month = 05 or month = 06.
if month_high < 03 or month_high >06 or year_high <> year.
-
give error message.
endif.
endif.
If month = 07 or month = 08 or month = 09 or year_high <> year.
if month_high < 06 or month_high > 09.
-
give error message.
endif.
endif.
If month = 10 or month = 11 or month = 12.
if month_high < 10 or month_high > 12 or year_high <> year.
-
give error message.
endif.
endif.
endif.
endloop.
Reward if helpful.
Regards.
Edited by: Akshay Raj on Mar 6, 2008 1:20 PM
Edited by: Akshay Raj on Mar 6, 2008 1:21 PM
In all the if statements with " year_high".. modify them as..
year_high NE year.
‎2008 Mar 07 10:47 AM
the following logic will certainly help you
AT SELECTION-SCREEN ON s_date.
IF s_date-low+0(4) <> s_date-high+0(4).
MESSAGE e000(vz) WITH text-e01.
ENDIF.
IF s_date-low+4(2) <= '3' AND s_date-high+4(4) <> '0331'.
CONCATENATE s_date-low+0(4) '03' '31' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '3' AND s_date-low+4(2) <= '6' )
AND s_date-high+4(4) <> '0630'.
CONCATENATE s_date-low+0(4) '06' '30' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '6' AND s_date-low+4(2) <= '9' )
AND s_date-high+4(4) <> '0930'.
CONCATENATE s_date-low+0(4) '09' '30' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ELSEIF ( s_date-low+4(2) > '9' AND s_date-low+4(2) <= '12' )
AND s_date-high+4(4) <> '1231'.
CONCATENATE s_date-low+0(4) '12' '31' INTO w_last_date.
MESSAGE e000(vz) WITH text-e02 w_last_date.
ENDIF.