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

Data validations

Former Member
0 Likes
544

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
Read only

Clemenss
Active Contributor
0 Likes
511

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
Read only

Former Member
0 Likes
511

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

Read only

Former Member
0 Likes
511

parametrs p_date type sy-datum default sy-datum.

at selection-screnn.

if sy-atum = p_datum.

msg.

endif.

Read only

Clemenss
Active Contributor
0 Likes
512

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