You are using the DataType Year in your custom code logic in the Cloud Application Studio. When the end-user attempts to use this field, they are allowed to enter all values including characters (e.g. '201Y'), and the system does not give a warning or an error message.
Reproducing the Issue
The issue could occur in any view or document where you have added this field. We will use the Sales Order document as an example:
- Go to the Sales Orders work center.
- Go to the Sales Orders view.
- Open any sales order.
- Locate the extension field XYZ that you have created for the data type year (XYZ represents the name of the extension field).
- In field XYZ, enter any value e.g. 201Y.
- Select the Save button.
- The system will accept this value, even though it is not a date format.
You expect that only a date value such as yyyy (yyyy represents the year)
The Root Cause of this issue, is caused by the Implementation Type of this DataType. It is of type CHAR, which comes from the DataType String.
This means all characters can be used as values. Please see the below image, taken from the Repository Explorer within the SDK:
To resolve this issue, you will need to create your own custom code logic, to implement a Validation for this field, to ensure that only the desired values are entered.
A workaround for this issue, can also be to create and implement a Drop-Down List instead of allowing end-users to enter their own values.
For further information, please also refer to the below tools:
- The Repository Explorer inside the Cloud Application Studio SDK.
- The SAP Cloud Application Studio Help documentation inside the SDK.
- The SAP SCN, in the Cloud Application Studio forum.
KBA , LOD-CRM-EMP , Employee , How To