cancel
Showing results for 
Search instead for 
Did you mean: 

Date convert

Former Member
0 Kudos

Hi all,

I want to convert a date (e.g. 2007-06-15) in format 20070615. I used the DateTrans - Function (yyyy-MM-dd to yyyyMMdd). Normally it works fine. But if the incoming date is 0000-00-00 the result is 00021130. Whats wrong, how to get the correct date (00000000)?

Is there an adjustment in XI, that the internal format (incoming e.g. from a rfc-adapter) is in format YYYYMMDD and not YYYY-MM-DD.

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Mathias,

Do you think 0000-00-00 is the correct date format? If you really get the input like this ,then I suggest you to compare the inpu with constant 0000-00-00 , if both are equals then map constant 00000000 to the output else use DateTrans and map to the output.

What do you say?

Best regards,

raj.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I think Raj has given the perfect solution. Just use mapping comapre the date if it is coming 0000-00-00 then pass 00000000 else actual date. write a user defined function.

Regards

Hemant

Former Member
0 Kudos

Ebel,

Use an if condition. If the date is equal to 0000-00-00 then you pass 00000000 else you use the conversion what you have specified. This should work because if you dont have date then I think you are sending this, if you have date assuming it is coming in the correct format.

---Satish

Former Member
0 Kudos

Mathias,

Take the date , month, year value to a constant and use an if else condtion to proceed further. Only if the value is greater than 0 you will proceed further with mapping.

thanks

Pavan

Former Member
0 Kudos

Mathias,

This is not so much a problem in XI but rather the way Java behaves.

One way to tackle this problem might be to use the 'replaceString' function (under 'Text'), replacing - with an empty constant.

Kind regards,

Koen

Former Member
0 Kudos

Thanx,

but is there no general functions to switch to the internal SAP date format?

justin_santhanam
Active Contributor
0 Kudos

Mathias,

Will you get only Date as 0000-00-00 or u may get other possibilities like 0001-00-00 or 0000-01-00 etc...

an u please clarify? Also as I mentioned above do u think is this proper date ?

Best regards,

raj.