‎2006 Jun 01 1:57 PM
Hi..
I want two things
1) The date field on my selectionn screen should be sy-datum minus 30 days..
please tell me the command name.
2) Also I want to give an err message IF to-date minus from-date > 30
Please tell me the command in this case also.
‎2006 Jun 01 1:58 PM
Hi,
First decalre a variable v_date type sy-datum.
v_date = sy-datum-30.
parameters:p_date type sy-datum default v_date.
For displaying the error message,
let us say,
REPORT Z11 message-id smsg .
select-options : s_date for sy-datum.
data: v_date1 type sy-datum,
v_date2 type sy-datum,
v_date3 type i.
v_date1 = s_date-low.
v_date2 = s_date-high.
v_date3 = v_date2 - v_date1.
if v_date3 > 30.
message e000 with 'improper date'.
endif.Regards,
Aswin
‎2006 Jun 01 2:13 PM
Thanks
But is there any event which we can use to fill the Selction-option Date fields..I mean like start-of-selection event, where shall we calculate v_date = sy-datum-30.
And also under which event we shall give an err message for the date field?
Thanks
‎2006 Jun 01 2:14 PM
Hi again,
1. But is there any event which we can use to fill the Selction-option
INITIALIZATION
2.
But is there any event which we can use to fill the Selction-option
START-OF-SELECTION.
Then on error we can give,
LEAVE LIST-PROCESSING.
3. Please see my previous reply.
(it contains the full code)
regards,
amit m.
‎2006 Jun 01 2:14 PM
Hi Subash,
put that code in <b>AT SELECTION SCREEN</b> event
Regards,
Santosh
‎2006 Jun 01 2:16 PM
Hi,
Use the Initialization event to initialize the date parameter.
You can give the error message in AT Selection-screen.
Regards,
Message was edited by: Amit Mishra
‎2006 Jun 01 1:59 PM
Hi Soni,
Use the function module CCM_GO_BACK_MONTHS to go back one month.
Refer the code below.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = '001'
IMPORTING
newdate = lv_newdate.
<b>Reward points if it helps.</b>
Message was edited by: Amit Mishra
‎2006 Jun 01 2:00 PM
hi Soni,
Use FM <b>CCM_GO_BACK_MONTHS</b>
DATA L_DATE TYPE SY-DATUM.
CALL FUNCTION <b>'CCM_GO_BACK_MONTHS'</b>
EXPORTING
CURRDATE = SY-DATUM
BACKMONTHS ='001'
IMPORTING
NEWDATE = L_DATE.
MOVE : L_DATE TO S_FKDAT-LOW ,
SY-DATUM TO S_FKDAT-HIGH.
APPEND S_FKDAT.
‎2006 Jun 01 2:05 PM
Hi,
i very simple
<b>1) Condition</b>
simly minus 30 from the sy-datum.
lv_date type dats.
lv_date = sy-datum - 30.
<b>2) Condition</b>
lv_days type i.
lv_days = to_date - form_date.
.if lv_days > 30.
message e100(meddage_id).
endif.
Mark Helpfull Answers
Message was edited by: Manoj Gupta
‎2006 Jun 01 2:07 PM
Hi subhash,
1. both cases
a) default date
b) difference checking
2. just copy paste in new program.
3.
report abc.
DATA : DIFF TYPE I.
*----
parameters : fdate type sy-datum.
parameters : todate type sy-datum.
*----
INITIALIZATION.
FDATE = SY-DATUM - 30.
*----
START-OF-SELECTION.
DIFF = TODATE - FDATE.
IF DIFF > 30.
MESSAGE 'DATE IMPROPER' TYPE 'S'.
LEAVE LIST-PROCESSING.
ENDIF.
regards,
amit m.
‎2006 Jun 01 2:09 PM
You can also use Function Module MONTH_PLUS_DETERMINE
with the date and -1 for MONTHS parameter.
Cheers,
Thomas.
‎2006 Jun 01 2:15 PM
use the below code as an example..
tables mara.
data res_dat like sy-datum.
select-option s_1 for mara-erdat.
initialization.
s_1-low = sy-datum - 30.
at selection-screen.
res_dat = s_1-low - s_high.
if res_dat > 30.
<give ur error message here>
endif.
Cheers,
Abdul Hakim
Mark all useful answers
‎2006 Jun 01 2:18 PM
initialization.
s_date-low = sy-datum - 31.
s_date-high = sy-datum.
s_date-sign = 'I'.
s_date-option = 'EQ'.
append s_date.
clear s_date.
at selection-screen.
read s_date index 1.
if s_date-high - s_date-low > 30.
message e000(ZZ) with 'Invalid Date range'.
endif.
REgards,
Ravi
‎2006 Jun 01 3:00 PM
Hi,
put the variable sy-datum-30 in the <b>initialization</b> event and the message in the <b>start-of-selection</b> event.
Regards,
Aswin
‎2006 Jun 01 3:09 PM
hi subhash,
under the event.
<b>Initialization</b>
s_date-low = sy-datum - 30.
s_date-high = sy-datum.
s_date-sign = 'I'.
s_date-option = 'EQ'.
append s_date.
at selection-screen.
if s_date-high - s_date-low > 30.
message e001(ZZ1).
endif.
hope this helps,
priya.
‎2006 Jun 01 3:09 PM
hi subhash,
under the event.
<b>Initialization</b>
s_date-low = sy-datum - 30.
s_date-high = sy-datum.
s_date-sign = 'I'.
s_date-option = 'EQ'.
append s_date.
at selection-screen.
if s_date-high - s_date-low > 30.
message e001(ZZ1).
endif.
hope this helps,
priya.