cancel
Showing results for 
Search instead for 
Did you mean: 

Un-seperatable date format in ECC-PI-AUTOID integration

Former Member
0 Kudos

Dear Experts,

I am working on PI7.3.1 for ECC to AUTO-ID integration. I have a requirement to convert the date format 20130620183100 of incoming Idoc field to  2013-06-20T 18:31:00Z

First i tried to achieve the format  2013-06-20 18:31:00 by using DATE TRANSFORMATION function selecting Date Format as 'YYYYMMDD' Time Format as 'HHMMSS' Date Separator as '-'  Time Separator as ':' and Separator as ' '   and i thought later i can think of variables T and Z. When i executed the above mapping i got error as Function Exception "Un-seperatable Date : 20130620183100"

Then i gone through through below blog

https://scn.sap.com/thread/1995507 and came to know that i should develop a UDF for this requirement.

Let me know whether i am correct or not.

Also any one has come across this type of requirement please give the necessary UDF code, if any.

Bit Urgent

Regards

Koti Reddy

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

Uncheck "Calendar is Lenient" and use below pattern

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

I have already tried this but i shows the error.

Regards

Koti Reddy

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Here  is simple UDF...  Please try this...

also refer this link for understanding... http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

import java.text.SimpleDateFormat;
import java.util.Date;

public String convertDateToString(Date idocDate) {

       String dateFormat ="yyyy-MM-dd'T' HH:mm:ssZ";

    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);

    return sdf.format(idocDate);

}

Note: I assume that you get Date type from idoc field.

former_member184681
Active Contributor
0 Kudos

Hi Koti Reddy,

Try with the following settings in the standard mapping function:

Then use replaceString to replace the space " " with "T", and finally concat with Z to achieve the expected result.

Regards,

Greg

ambrish_mishra
Active Contributor
0 Kudos

minor correction in Greg's response above.

Input date format will be YYYYMMddHHmmss

Output format will be YYYY-MM-dd HH:mm:ss

Former Member
0 Kudos

Hi Greg,

I followed this logic

with output date format as YYYY-MM-dd HH:mm:ss but it shows the same error.

I would like to bring one thing to your notice that at receiver side the type of the field is XSD:DATE. Can it accept T and Z (or) do i want to create a new date field with type as STRING ???

Regards

Koti Reddy