Programming

SAP Object Types and Object Node Types

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.

 

SAP Object Type: SalesOrder

 

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).

 

Type Category of an SAP Object Type

 

The possible values of a type category are explained here.

 

Type Categories of SAP Object Types

 

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.

 

SAP Object Node Type SalesOrder: A Root Node

 

SAP Object Node Type SalesOrderItem

 

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.

Recommendation

Core Data Services for ABAP
Core Data Services for ABAP

If you’re developing ABAP applications, you need CDS expertise. This book is your all-in-one guide, updated for SAP S/4HANA 2023! Start by learning to create and edit CDS views. Walk through CDS syntax and see how to define associations and annotations. Further refine your model by implementing access controls, service bindings, and table functions. Understand the CDS-based virtual data model, and then follow step-by-step instructions to model analytical and transactional applications. From modeling to testing to troubleshooting, this is the only book you need!

Learn More
SAP PRESS
by SAP PRESS

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!

Comments