Application Development 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: 

Data validations

Former Member
0 Kudos

Hi,

i want to do data validation for strat date(default to system date). plz give me code for this....

Thanks,

Ankitha

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

Hi ankitha,

parameters:
  p_start type sydatum obligatory default sy-datum. "forces correct format
AT selection-screen on p_start.
  perform date_validation using p_start.

form  date_validation using p_date type sy-datum.
* do meaningful checks here, i.e.
  if p_date type > sy-datum.
    message E000(R1) 'Date must not be in the future'.
  endif.
endform.

In case of error, the cursor will jump to the parameter input field and mark it red color.

Regards,

Clemens

3 REPLIES 3

Former Member
0 Kudos

You can use the function module <b>DATE_CHECK_PLAUSIBILITY</b> in the event AT SELECTION SCREEN ON <selscreen field> to validate the date.

Former Member
0 Kudos

parametrs p_date type sy-datum default sy-datum.

at selection-screnn.

if sy-atum = p_datum.

msg.

endif.

Clemenss
Active Contributor
0 Kudos

Hi ankitha,

parameters:
  p_start type sydatum obligatory default sy-datum. "forces correct format
AT selection-screen on p_start.
  perform date_validation using p_start.

form  date_validation using p_date type sy-datum.
* do meaningful checks here, i.e.
  if p_date type > sy-datum.
    message E000(R1) 'Date must not be in the future'.
  endif.
endform.

In case of error, the cursor will jump to the parameter input field and mark it red color.

Regards,

Clemens