Skip to Content

UDF Help


I am facing a issue in message mapping. I am using the standard date transformation function to convert the input date ( MM/DD/YYYY) to SAP format (YYYYMMDD). But in few cases the input date is coming as 1/02/2014 rather than 01/02/2014. And as a result the mapping is failing.
Can someone help me with the UDF logic for this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Feb 16, 2014 at 03:50 AM

    Hi Amit - Just use the below UDF before the date transformation.




    Calendar calendar = Calendar.getInstance ( ) ;
    DateFormat dateFormat = new SimpleDateFormat ( "MM/dd/yyyy" ) ;

    return dateFormat.format (dateFormat.parse (a)) ; //a is your input
    catch ( Exception e )
    return "error";

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 16, 2014 at 07:31 AM


    Are u sure, ur mapping is failing becoz of date transformation becoz standard function is smart enough to adjust dates?

    Paste ur display queue output.


    Amit Srivastava

    Capture.PNG (16.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Amit and Hareesh. It is solved.

      @Amit :- I refreshed the mapping again and uploaded the test data by refreshing the cache and I am able to test successfully. The data transformation function is working fine. Somehow earlier it was giving a error. Not sure the reason for that.

      @Hareesh :- Thanks for the UDF.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.