Mentor SAP

Standard Operation CREATE

Standard Operation CREATE

 

To enable standard operation create for an entity, add the statement create; to the entity behavior body (curly brackets after statement define behavior for ..). To disable the operation, remove the statement or turn it into a comment.

 

Interesting additions to the create statement are as follows:

Internal

Prefix which disables the operation for external consumers of the BO.

 

features: global

Enable dynamic feature control. The decision, when the operation is enabled, is made dynamically in a behavior implementation.

 

precheck

A method is called before the create request to prevent unwanted changes from reaching the application buffer.

 

authorization: none

Excludes the create operation from the global authorization checks.

 

CREATE in Behavior Projection

 

To make standard operation create available in OData and SAP Fiori, it has to be reused in the behavior definition for the projection view (behavior projection).

 

To include standard operation create in the OData service, add the statement use create; to the entity behavior body (curly brackets after statement define behavior for ..). To disable the operation, remove the statement or turn it into a comment.

 

As soon as standard operation create is available in the OData service, the generated SAP Fiori elements app displays a Create button on the List Report page for the related RAP BO entity. By choosing this button, the user navigates to an Object page for a new entity instance.

 

Numbering

Primary Keys in RAP

 

The primary key of a business object entity can be composed of one or more key fields, which are identified by the keyword key in the underlying CDS view of the business object. The set of primary key fields uniquely identifies each instance of a business object entity.

 

The logic of the business object has to ensure that all entity instances are created with a unique set of primary key values and that the primary key values of an existing instance cannot be changed during modify operation update.

 

The editing is easily prevented by listing the key fields after statement field (read-only) in the behavior definition body. To only prevent editing during the operation update while still allowing the consumer to provide values during operation create, the keyword field (read-only: update) is used instead.

 

The process of providing a unique key during the creation of a new instance is called numbering.

 

There are various options to handle the numbering for primary key fields depending on when (early or late during the transactional processing) and by whom (consumer, application developer, or framework) the primary key values are set. You can assign a numbering type for each primary key field separately. The following options are available:

 

Numbering Techniques in RAP

 

There are various options to handle the numbering for primary key fields depending on when and by whom the primary key values are set. You can assign a numbering type for each primary key field separately. Note the following distinctions:

 

External vs Internal

In External Numbering, the consumer hands over the primary key values for the CREATE operation, just like any other values for non-key fields. The runtime framework (managed or unmanaged) takes over the value and processes it until finally writing it to the database. In this scenario, the behavior implementation has to ensure that the primary key value given by the consumer is uniquely identifiable. This is opposed to Internal Numbering where the key values are provided by the RAP BO logic. Optional External Numbering is a combination of external and internal numbering: The RAP BO logic only provides key values in case the consumer hands over initial values.

 

Managed vs Unmanaged