2007 Mar 29 12:25 PM
I have a requirement where i have to check date range in select option and if its more than 45days the I have to give an Informatory message and exit the programme , How can I do that ??
Urgent Plzz..
2007 Mar 29 12:28 PM
hi raghavender ,
You can subtract one date from other date and the result gives you the number of days.Use abbend message to display if it is greater than 45 days.
regards,
veeresh
Hi Raghavender,
You can do it by following way.......
If not s_date-low is initial and
not s_date-high is initial.
w_diff = s_date-high - s_date-low.
if w_diff GT 45.
message e398(00) with 'Enter date range within 45
days'.
**for exiting the program you can use
STOP.
endif.
endif.
Thanks and Regards,
Kunjal Patel
2007 Mar 29 12:26 PM
If not s_date-low is initial and
not s_date-high is initial.
diff = s_date-high - s_date-low.
if diff GT 45.
message e001(ZZ) with 'Enter date range within 45
days'.
endif.
endif.Message was edited by:
Chandrasekhar Jagarlamudi
2007 Mar 29 12:28 PM
hi raghavender ,
You can subtract one date from other date and the result gives you the number of days.Use abbend message to display if it is greater than 45 days.
regards,
veeresh
2007 Mar 29 12:29 PM
hi
if s_date-low is not initial and s_date-high is not initial.
if s_date-high-s_date-low > 45.
message 'Enter a lower range' type 'E'.
endif.
endif.
if helpful, reward
Sathish. R
2007 Mar 29 12:43 PM
Hi,
try this code...
TABLES: zpr_prog_item.
DATA: cnt TYPE i.
SELECT-OPTIONS date FOR zpr_prog_item-date_shoot.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = date-high
i_datum_von = date-low
IMPORTING
e_tage = cnt
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 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.
IF cnt < 45.
LEAVE TO LIST-PROCESSING.
WRITE:/ date-low,
/ date-high,
/ cnt.
ELSE.
MESSAGE i000(zsam).
LEAVE SCREEN.
ENDIF.
regards,
Bhuvana.
2007 Mar 29 12:47 PM
Hi Raghavender,
You can do it by following way.......
If not s_date-low is initial and
not s_date-high is initial.
w_diff = s_date-high - s_date-low.
if w_diff GT 45.
message e398(00) with 'Enter date range within 45
days'.
**for exiting the program you can use
STOP.
endif.
endif.
Thanks and Regards,
Kunjal Patel
2007 Mar 29 12:53 PM
this is the code
select-options:
s_date type sy-tatum.
at selection-screen.
if s_date-high - s_date-low eq '45' .
message error
endif.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |