on 04-18-2017 10:53 AM
Hi Expert,
I am facing issue while updating the date field with blank value. I am posting the record in table using XSJS. If I am passing the value as "CHANGEDON":"2017-04-13", in request payload, it is getting inserted with the correct value.
But when I am trying to post the record with blank date value with below different format "CHANGEDON":"00000000", "CHANGEDON":"0000-00-00", "CHANGEDON":"", the value is getting inserted as CHANGEDON = 31.12.-1
Please share your needfull suggestion.
Regards,
Anurag Singh
Hi anuragsingh,
DateTime fields do not allow you to store empty or null values.
A Date field should store the value '00000000' when you insert empty values into them
Please check the following documentation:
In essence, here is how it should work:
CREATE ROW TABLE T (ID INT, CHANGEDON DATE, CREATEDON DATE);
INSERT INTO T VALUES (1, '', '0001-01-01');
INSERT INTO T VALUES (2, '0000-00-00', '0001-01-01');
INSERT INTO T VALUES (3, '0000-00-00', '0001-01-01');
INSERT INTO T VALUES (4, NULL, '0001-01-01');
INSERT INTO T VALUES (5, '2022-01-01', '2022-01-01');
SELECT * FROM T WHERE CHANGEDON = '00000000'; <-- This will return all rows
SELECT * FROM T WHERE CHANGEDON = ''; <-- This will return all rows
SELECT * FROM T WHERE CHANGEDON IS NULL; <-- This will return all rows
SELECT * FROM T WHERE CHANGEDON IS NOT NULL; <-- This will return only row # 5
If date is being stored with a negative year, then I would open a support ticket so SAP can investigate this issue in detail. Best regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.