Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

validation

Former Member
0 Likes
580

i am having date field in my input screen in the

format yyyymm.i want to validate this field.if i enter some other text it should show error message.ie i should accept like 200710,200705etc.how can i validate this field.plz help me.

4 REPLIES 4
Read only

Former Member
0 Likes
552

Hi,

Delcare field as sy-datum or any date field.

parameter : date like sy-datum(6).

Validation system will take care of it.

Thanks,

Sriram Ponna.

Message was edited by:

Sriram Ponna

Read only

Former Member
0 Likes
552

Hi,

parameters:

p_date type sy-datum.

this statement will automatically validate the field,

it will validate according to the system settings.

Read only

naimesh_patel
Active Contributor
0 Likes
552

I had tried to search for something stadnard for this purpose.. but I failed.

So, I developed some small logic. May be this will help you..!

REPORT  ZTEST_NP.

DATA: L_MON(2) TYPE N,
      L_YEAR(4) TYPE N.

PARAMETERS: P_MONTH(6) TYPE N.

AT SELECTION-SCREEN ON P_MONTH.
  CALL FUNCTION 'CONVERSION_EXIT_GJAHR_INPUT'
    EXPORTING
      INPUT       = P_MONTH+2(2)
    IMPORTING
      OUTPUT      = L_YEAR
    EXCEPTIONS
      WRONG_INPUT = 1
      OTHERS      = 2.
  IF SY-SUBRC <> 0.
    MESSAGE E398(00) WITH  'year is not valid'.
  ELSE.
    P_MONTH+0(4) = L_YEAR.
  ENDIF.

  L_MON = P_MONTH+4(2).
  IF L_MON > 13 OR L_MON < 1.
    MESSAGE E398(00) WITH 'Month is not valid'.
  ENDIF.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
552

Hi veera,

DATE_CHECK_PLAUSIBILITY function module checks wrong input in date field...

anyway if you define field LIKE sy-datum then automatically validates..

Thanks

Message was edited by:

Perez C