cancel
Showing results for 
Search instead for 
Did you mean: 

Unparseable date "" mapping

Former Member
0 Kudos

Hello,

The mapping is between  source date1 field to target date2 field  . If date1 exists then do date transformation  and map to date2 else I am passing a constant.

I keep getting error when i test mapping as Unparseable date "".

If there is value in date1 it works fine. When there is no value in source date1 it gives me the above error. Please advice.

Thanks,

Teresa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Teresa,

Its datetrans function which is throwing error when no date is available for input to it. I will suggest use mapwithdefault before datetrans function.

default date in mapwithdefault should be in source side format used in DateTrans function.

hope this helps

Ankit

Former Member
0 Kudos

Thanks Ankit. The user does not want any date to come into SAP in date2 if there is no date1. Thus I need to pass a blank value to date2 if there is no date1 is this possible?

former_member184681
Active Contributor
0 Kudos

Dear Teresa,

Use the following logic:

Don't mind my field names , use date1 instead of DATLT and date2 instead of Country.

Regards,
Greg

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>I believe you created string for the sender and target date field. why don't send just constant field (empty) in the else block if the data is not available.

Removing my reply, Greg already answered the else block.

Former Member
0 Kudos

Hi Greg,

Thank you so much . If i do not have any value in DATLT i still get the unparseable date error. Ami missing something here ?

Former Member
0 Kudos

Hi Baskar,

The data type for date is date not string in sender side. Receiver side is IDOC segment .

Former Member
0 Kudos

If Source structure field is date typed, then try to pass '0000-00-00' for empty value in source structure (or change field type to string).

former_member184681
Active Contributor
0 Kudos

Do you mean that there is no DATLT tag at all? Then you might need to add the exists() condition too:

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>The data type for date is date not string in sender side. Receiver side is IDOC segment .

Then equalsS text function would not work here. You have to use compare function to decide.

Former Member
0 Kudos

Hi Greg,

The sender side data type for date is date . I meant was there is no date1 value inside the tag.

date1 is blank and does not have any YYYY-MM-dd HH:mm:ss value in it.

Thanks ,

Teresa

Answers (2)

Answers (2)

Former Member
0 Kudos

When you pass constant then the receiver tag of date tyoe does not accepts it.

If you are passing a constant then pass a constant date instead of any other value.

Can you confirn if you are performing any date transformation (YYYYMMdd to ddMMYYY or something simillar)

Former Member
0 Kudos

Hi,

My date transformation is from YYYY-MM-dd HH:mm:ss to yyyyMMdd . The problem arises when there is no date1 value in source . So what default value i need to pass if there is no source date1 ?

The data type for date1 is date . Should i change it to String?

Teresa

baskar_gopalakrishnan2
Active Contributor
0 Kudos

If the business requirement is flexible to change from Date to String, you can try that too. Handling String data type is easier.

Question: What do you want to pass to target field if the date field is empty?  Current date or no mapping or Date in String format

Former Member
0 Kudos

Hi Baskar,

I do not want to pass anything to target field if source date field is empty. I just want to leave the target field blank in the IDOC.

Thanks,

Teresa

Former Member
0 Kudos

The reason i do not want to change it to string at this point because messages are already in PI and failed due to mapping error. My fear is that if I change to string an go to SXMB_MONI and restart those messages they may error out again as I changed the source data type. Also I need to contact the DBA admin to inform him that I have changed the data type to string for date field and he needs to change it on the DB side.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Try this UDF

 

Former Member
0 Kudos

Hi Baskar ,

I cannot see th UDF can you please post it again or message me.

Thanks,

Teresa

baskar_gopalakrishnan2
Active Contributor
0 Kudos

The file shows as attached. open and save the file.

Former Member
0 Kudos

Thank you Baskar. I will try with the UDF and let you know.

Teresa

former_member184681
Active Contributor
0 Kudos

Hi Teresa,

Use equalsS([empty string]) instead of exists() - they are not really equivalent. Make sure to use equalsS from Text functions.

Hope this helps,
Greg