‎2012 Jun 16 6:30 AM
Hi Gurus,
can i know how to validate a particular month ,
what i want t say is, when i compare my input date with sy-datum if the given date belong to same month it should execute
if the given input date does not belong to that month it should show error.
please help me to resolve it.
thanks & Regards.
Ron.
Moderator message : Not enough re-search before posting, discussion locked.
Message was edited by: Vinod Kumar
‎2012 Jun 16 6:45 AM
Hello Ron.
Good morning.
There can be many ways of doing the same, one way is :
lets say ur input is : p_date with value 16.02.2012 (ddmmyyyy) and sy-datum has the value 16032012.
U can write your logic as :
data : v_input_mnth type c,
v_current_mnth type c.
v_input_mnth = p_date+2(2). " after execution v_input_mnth will have 02
v_current_mnth = sy-datum+2(2). " after execution v_current_mnth will have 03
if v_input_mnth = v_current_mnth
perform ur_logic
else
perform show_error. " error if months are not same
endif.
Hope this will be usefull for you.
Thanks,
Gejo john
‎2012 Jun 16 7:14 AM
Hi Rohan,
You just need to take current month using SY-DATUM in a variable as follows:
gv_temp = sy-datum+2(2).
Now consider P_AEDAT ha input date.
GV_IDATE = P_AEDAT+2(2).
so to perform certain add condition:
IF gv_temp EQ GV_IDATE.
"Your logic.
ELSE.
" Dispaly message 'Current month is not equal to Entered Date's month '.
ENDIF.