Get Example source ABAP code based on a different SAP table
• LATE NUMBERING ABAP_BDL_PROP
ABAP_RAP - late numbering>
ABAP_SYNTAX ... late numbering ...>
What does it do? Defines internal> late numbering> for all primary key fields of a business object entity>. Internal late numbering means:
The RAP runtime engine> assigns values to the primary key fields.
In the ABAP behavior pool>, the RAP saver method> adjust_numbers> > must be implemented to assign a final primary key value for each entity instance.
The key value for an instance is assigned just before the instance is saved on the database. Thus, a gapless assignment of unique keys is ensured. Internal late numbering must be defined in the entity behavior characteristics> for each entity behavior definition> separately. If the parent node> of an entity defines late numbering, then its direct child node> must also define late numbering. When using late numbering> for a draft-enabled scenario, it is mandatory that the RAP draft table> has an additional key field DRAFTUUID > of data type raw(16)>.
ABAP_AVAILABILITY
Managed RAP BOs>
Unmanaged RAP BOs>
Managed and draft-enabled> RAP BOs
Unmanaged and draft-enabled> RAP BOs
In a projection BO>, late numbering is automatically reused from the base BDEF and does not need to be explicitly defined. For details, see topic TITLE >.
In a RAP BO interface>, late numbering is automatically reused from the base BDEF and does not need to be explicitly defined. For details, see topic TITLE >. ABAP_AVAILABILITY_END
ABAP_FURTHER_INFO For further conceptual background on early and late numbering, see the development guide for the ABAP RESTful Application Programming Model, section Numbering>.
Latest notes: Alternative options for numbering:
early numbering>>
numbering:managed>> NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 The following example shows an unmanaged BDEF that defines late numbering for the root view entity DEMO_UNMANAGED_LATE_NUMBERING> >. ABAP_NOTE This example does not fully meet the requirements of the RAP BO contract>. It is intentionally kept short and simple and focuses on specific RAP aspects. For example, BDEF strict mode> is not enabled. See more information on the RAP BO contract in the Development guide for the ABAP RESTful Application Programming Model>. BDEF DEMO_UNMANAGED_LATE_NUMBERING The ABAP behavior pool implements the local handler class adjust_numbers>. In this class, values are defined for the primary key field key_field>. The first new entity instance is assigned the value '1' and each new entity instance is assigned the next higher integer. Code snippet: METH BP_DEMO_UNMANAGED_LATE_NUMBERI(CCIMP)=>ADJUST_NUMBERS You can see the complete source code in the BP_DEMO_UNMANAGED_LATE_NUMBERICCIMP>>.
The ABAP class CL_DEMO_RAP_UNMANAGED_LATE_NMB>> uses EML> to access the RAP business object> and performs the following steps:
It creates three entity instances by specifying a value for the field data_field1_root>.
It commits the three new entity instances to the database.
Using the AB_SQL SELECT> statement, it displays the content of the database table. It can be seen that the primary key field KEY_FIELD> of each entity instance contains a value, which was generated by means of late numbering. Result: the values for the primary key field KEY_FIELD> are generated automatically. IMAGE ABDOC_LATE_NUMB.png 219 97 ABAP_EXAMPLE_END