cancel
Showing results for 
Search instead for 
Did you mean: 

Need Clarification on Date data type

Former Member
0 Kudos

Hi @ll

I have an source and target data type in which there is a field which is of xsd:date type. I mapped both of them using date transformation... In the transformation, the source has MM/dd/yyyy format which is transformed into yyyy-mm-dd format...

Every things well when the input are correct.... but when i give the wrong input date like 123/34/2007 or some others...it does not throwing any errors...just converts source into target format with some garbage values...

I changed the source and target field to string type with the same transformation..but even then same thing happens...

Can any one explain what's going on here..where i am making the mistake...

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi there,

See this post:

User defined function to validate the input.

Something like (from the above post, by jithesh balakrishnan):

Date dtobj = new Date(strgDate); //convert the string into date object.

Format formatter = new SimpleDateFormat("yyyy/MM/dd"); //specify the required format.

formatter.format(dtobj); //format ur date

return dtobj;

Former Member
0 Kudos

So you guys mean to say that we have to manually check the source date format....but can you explain how i can throw excpetion or error message with out using BPM..

prabhu_s2
Active Contributor
0 Kudos

use the code provided in a udf and if the format doenst adheres to the format then rasie a exception. u can do this without a bpm also

henrique_pinto
Active Contributor
0 Kudos

Check out throwing the blog about throwing alerts from UDF, by Bhavesh Kantilal.

But if you just want to raise exception, do it explicitely in UDF. Or use Michal's blog on raising standard mapping exceptions from abap.

Regards,

Henrique.

Answers (1)

Answers (1)

prabhu_s2
Active Contributor
0 Kudos

had exp this earlier and here the date transformation will not throw any error. u may use a udf to check for valid date and inside the udf u an raise an exception