How to add UI.Hidden annotations in SAP UI5

@UI.Hidden annotation is used in CDS View to hide a particular column from the SAP UI5 Table. The CDS view annotation line looks like below

@UI.Hidden: true

The above CDS UI.Hidden Annotation will generate the following Annotations in the Metadata

                    <Annotations Target="CustomerNamespace.CustomerType/Id"
                       xmlns="http://docs.oasis-open.org/odata/ns/edm">
                        <Annotation Term="com.sap.vocabularies.UI.v1.Hidden" />
                    </Annotations>

As you can see from the above XML Code, the Property specified here is ‘Id’. so this will hide the Column from the SAP UI5 table.

Customer Id column is hidden in SAP UI5 Smart Table

Namespace used is com.sap.vocabularies.UI.v1.Hidden

                        <Annotations Target="CustomerNamespace.CustomerType"
                           xmlns="http://docs.oasis-open.org/odata/ns/edm">
                            <Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
                                <Collection>
                                    <Record Type="com.sap.vocabularies.UI.v1.DataField">
                                        <PropertyValue Property="Value" Path="Name" />                                   
                                    </Record>                                 
                                    <Record Type="com.sap.vocabularies.UI.v1.DataField">
                                        <PropertyValue Property="Value" Path="Id" />                                        
                                    </Record>                                 
                                </Collection>
                            </Annotation> 
                        </Annotations>                 
                        
                        <Annotations Target="CustomerNamespace.CustomerType/Id"
                           xmlns="http://docs.oasis-open.org/odata/ns/edm">
                            <Annotation Term="com.sap.vocabularies.UI.v1.Hidden" />
                        </Annotations>

Please do not use the initiallyVisibleFields property of the Smart table in combination with the LineItem/Hidden Annotation. As this will result in unexpected results. The Smart Table may add additional fields which is not mentioned in the LineItem Annotation.