HI prakash,
You can set the field 1 as mandatory field . sap will automatically provide error message then.
For field 2 , Field 3 -
IF FIELD2 is initial or field3 is initial.
message " error values " type 'E'.
endif.
as field 4 is optional you can leave it without writing any error message.
DO read the validation on net . You will find lots of threads regarding this..
Regards,
Sivaganesh