If the data type of this attribute in SAP is a DATE or something similar, then simply convert the input string to a Date/Time value (using the TO_DATE() function) and forward this Date/Time port to the SAP table target.
Otherwise please explain what data type this attribute has in SAP.
thanks a lot for ypur support, i have solved using the following expression:
Where data_doc is a date coming from a flat file with format as 2021-02-28
Now i'm able to post date into a SAP table with the correct format -> 28.02.2021
But when the date value from file is NULL (and it can happen) the expression fails producing a warning without any posting in table.
Do you know how can i overtake this issue? Have I to use IIF expression and if yes how can do it?
Thanks so much!!
1 of 1 people found this helpful
As far as I understand it, that depends on how this particular date value is set up within SAP. Maybe this field must not be NULL? In this case you will have to provide a "default" value (your SAP people should be able to tell you which one), and that can be done as follows (assuming for this example that the default date is Dec. 31st, 2999):
IIF( IsNull( DATA_DOC),
TO_DATE( '29991231', 'YYYYMMDD'),
TO_DATE( DATA_DOC', 'YYYY-MM-DD')
If the field is allowed to be NULL, then a NULL value from the source should be forwarded to the target as a NULL value. But you can make double-sure that this works using the following expression:
IIF( IsNull( DATA_DOC) OR Length( RTrim( DATA_DOC)) = 0,
TO_DATE( DATA_DOC, 'YYYY-MM-DD')
Granted, this looks like overkill, and that's true: I've inserted two special cases here, namely that the source fields is NULL and that it consists of blanks only (instead of carrying a valid date). I'm just cautious.
Thanks a lot Nico! It works changing as you have suggested.