SAP object types and SAP object node types hold very little information. Their essential task is to represent a business-related object to which other entities or development objects are related.
SAP object types and object node types are defined in the ABAP Development Tools (ADT) as SAP Object Type and SAP Object Node Type. The figure below shows the SAP object type SalesOrder in ADT.
The attribute Object Type Code of an SAP object type is a numeric alternative key that can be used for identifying the SAP object type in integrations between systems or cloud services. The attribute Type Category specifies a category of an SAP object type (see figure and table below).
The possible values of a type category are explained here.
While an SAP object type is a complex aggregate object that represents all its substructures, an SAP object node type models a simple substructure of an SAP object type. The figures below show the SAP object node types SalesOrder and SalesOrderItem, which both belong to the SAP object type SalesOrder.
Every SAP object type has an SAP object node type, usually with the same name, which represents the header data of the object. This root node is identified by the Root Node Flag checkbox.
A CDS entity can be assigned to an SAP object node type by annotation @ObjectModel.sapObjectNodeType.name and hence also to an SAP object type. Multiple CDS entities with different purposes could be assigned to the same SAP object node type. The annotated CDS entities provide rich information for the object node type: data fields, associations, and further annotations. From the associations of CDS entities, even the relations between SAP object node types and object types can be derived.
If it’s not suitable, due to technical reasons, to connect CDS models by associations, a code or ID field can be annotated with @ObjectModel.sapObject-NodeTypeReference to point to the SAP object node type that is identified by that field. The annotation thus defines a kind of foreign key relation to an SAP object node type. This approach is, for example, applied by SAP to remote API views.
Editor’s note: This post has been adapted from a section of the book Core Data Services for ABAP by Renzo Colle, Ralf Dentzer, and Jan Hrastnik.