‎2008 Jun 30 8:03 AM
Hi there,
I was wondering if there was a way to check whether an inputted parameter was YYYYMM and not YYYYMMDD.
‎2008 Jun 30 8:13 AM
Hi,
You can check like this also
At Selection-screen.
w_len = strlen( p_date ).
if w_len eq 6 and p_date+4(2) gt 12.
message 'Date format is wrong enter only YYYYMM'.
elseif w_len ne 6 .
message 'Date format is wrong enter only YYYYMM'.
endif.
Regards,
Rajitha.
‎2008 Jun 30 8:04 AM
You can check the string length of that parameter.
e.g. Use STRLN(P_DATE)
‎2008 Jun 30 8:08 AM
Hi
Check out this Code Hope it gives you an idea
DATA :
w_dat1 TYPE sy-datum,
w_dat2 TYPE d VALUE '20080530'.
w_dat1 = sy-datum.
IF w_dat1(6) EQ w_dat2(6).
WRITE :
/ 'Both dates are same'.
ELSEIF w_dat1(6) NE w_dat2(6).
WRITE :
/ 'Both are Ne'.
ENDIF.
Regards
Pavan
‎2008 Jun 30 8:08 AM
hi,
There is no such way i m afraid.
But you can validate that thing in ur code.
Create a parameter of 6 characters length not an 8 char long.
Then usin offset select the year and month part and validate the date accordingly.
Hope this will help.
Reward points if helpful.
Regards
Sumit Agarwal
‎2008 Jun 30 8:13 AM
Hi,
You can check like this also
At Selection-screen.
w_len = strlen( p_date ).
if w_len eq 6 and p_date+4(2) gt 12.
message 'Date format is wrong enter only YYYYMM'.
elseif w_len ne 6 .
message 'Date format is wrong enter only YYYYMM'.
endif.
Regards,
Rajitha.
‎2008 Jun 30 8:15 AM
‎2008 Jun 30 8:22 AM
\[removed by moderator as it was just a copy and paste answer of someone else's work without giving a source \]
Edited by: Jan Stallkamp on Jun 30, 2008 2:56 PM
Edited by: Jan Stallkamp on Jun 30, 2008 2:59 PM