cancel
Showing results for 
Search instead for 
Did you mean: 

help with Date transformation standard function

Former Member
0 Kudos

Hello,

I am using DateTransformation standard function with the following data formats.

format of source data : yyyyMMdd

format of target data : yyyy-MM-dd

I was trying with different test data as inputs .

1. input : 20080101- Output : 2008-01-01 ( No issues, its working correct)

2. input : 20090101- Output : 2009-01-01 ( No issues, its working correct)

3. input : 21112222- Output : 2112-10-22 ( giving wrong transformation )

Q: I just wanted to know how do the date transformation function works in the background? I mean how does it start tranforming after it picks up input data?

Q : Why was it generating 2112-10-22 instead of a error message that the date format is wrong(coz month 22 doesnt exists)? (refer to case 3 )

Regards,

Nikhil.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

you are doing the date conversion

that is

format of source data : yyyyMMdd

format of target data : yyyy-MM-dd

the result will be the yyyy - mm- dd

that is your two result will be right because you are giving the valid month

1. input : 20080101- Output : 2008-01-01 ( No issues, its working correct)

2. input : 20090101- Output : 2009-01-01 ( No issues, its working correct)

in the 3rd result result will be wrong because you are giving the wrong month that is 22 xi do not undestand such type of month

3. input : 21112222- Output : 2112-10-22 ( giving wrong transformation )

xi just transform the conversion that you have given and he do not converted month in to the year

better you give 2112-10-22

i hope its helpfull for you

thanks

Regards

vijay

Former Member
0 Kudos

Thanks for your replies.

I know that the problem is with month (coz I wantedly entered the same)

but I want a error message to be generated instead of a wrong data value.

in case, the user enters a wrong data format, it shud generate message or error message .

Here, I am populating some valid date for a incorrect date entries . It shouldnt be the case.

how do I proceed so that I get error message here?

Thanks

Nikhil.

prateek
Active Contributor
0 Kudos

XI is not making any mistake here. if u observe closely, ur input is 2111 22 22

Here 22 in the middle portion is month. Since it is more than 12, XI subtracts 12 from it and add these 12 months as 1 year. Therefore the output becomes

yyyy = 2111+1 MM = 22-12 DD = 22

i.e. 2112-10-22

Similarly if month is more than 24 then it will add 2 years.

U can write a small UDF if u want to get the error message. Also see this

/people/robin.schroeder/blog/2006/11/21/dynamic-date-conversion-in-message-mapping

Regards,

Prateek

Former Member
0 Kudos

Thanks Prateek,

Nikhil.

Answers (2)

Answers (2)

Former Member
0 Kudos

what will be the standard date format of sap

Former Member
0 Kudos

HI,

Yes Exactly the Month is only the cause

Regards

Seshagiri