cancel
Showing results for 
Search instead for 
Did you mean: 

Date Validation in UDF

Former Member
0 Kudos

Hi

I want to do the Date validation in mapping using the UDF...if Validation fails i wanna throw the Runtme Exception in UDF

SV

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey

You can try the following

/people/ranjit.deshmukh/blog/2008/01/14/validations-using-java-for-those-not-having-pi71

/people/jacob.vandborg/blog/2005/11/29/schema-validation-of-incoming-message

Thanx

Aamir

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The following blog contains your full solution:

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5479] [original link is broken] [original link is broken] [original link is broken];

In the udf ThrowException in the blog just give the validating condition of the date as you wish and IF the condition doesn't satisfy write the statement

ExceptionThrower.fire("Validation of date failed.");

by using this UDF in your graphical mapping you will be able to throw a Runtime Exception.

**Reward points if helpful.

--Sankar Choudhury

Former Member
0 Kudos

Hi,

Yes u can do it in UDF.

1) By using If-Else check your date validation.

2) Use two input in UDF 1st is date 2nd one constant which u want to validate.

3) Use RemoveContext before UDF

4) To throw an exception use any java function and give wrong input to it.

e.g. Use Substring to detect 10 characters and send blank input. this will throw exception.

Regards,

Rohit.

Reward points if helpful.