Get Example source ABAP code based on a different SAP table
• FIELD ABAP_BDL_INTERFACE • READONLY ABAP_BDL_INTERFACE , FIELD • MANDATORY CREATE ABAP_BDL_INTERFACE , FIELD • READONLY UPDATE ABAP_BDL_INTERFACE , FIELD • SUPPRESS ABAP_BDL_INTERFACE , FIELD
What does it do? An interface BDEF automatically and implicitly inherits all RAP field characteristics> of its underlying base BO and it can add further field attributes. The field attributes added in the interface layer are added to the field attributes from the base layer, if any. Therefore, the field attributes from the base layer and from the interface layer must not contradict each other. Examples:
If the base BDEF defines a field as mandatory:create>, the interface can add the field attribute readonly:update> to the same field.
If the base BDEF defines a field as mandatory>, the interface must not define the same field as readonly>. This leads to a syntax check error. The following field characteristics are available in an interface BDEF:
readonly>
mandatory:create>
readonly:update>
suppress> Topic RAP BDL - field characteristics> describes how they work. In a managed or unmanaged RAP BO, multiple field characteristics can be combined. In an interface BDEF, there is only one valid combination: mandatory:create, readonly:update>. Commas can be used to classify multiple fields in the same way. Example: field(readonly) Field1, Field2, Field3;>.
ABAP_EXAMPLE_VX5 The following managed RAP behavior definition defines internal numbering for the primary key field and it defines field INT_FIELD1> as mandatory>. BDEF DEMO_CDS_INTERF The following interface BDEF automatically inherits all field attributes from the base BDEF and specifies additional static field attributes: BDEF DEMO_CDS_PV The ABAP class CL_DEMO_RAP_INTERFACE>> uses EML> to access to RAP business object> and performs the following steps:
It creates three entity instances by specifying values for the two mandatory fields INT_FIELD1> and CHAR_FIELD1>. However, no values for the primary key field are specified.
It commits the three new entity instances to the database.
Using the AB_SQL SELECT> statement, it displays the content of the underlying database table. It can be seen that the primary key field KEY_FIELD > of each entity instance contains a value that was generated by means of managed early numbering>. Code Snippet: ABEXA 01723 Result: values for the primary key field are generated automatically. IMAGE interface_result.png 426 96 The field INT_FIELD2> is excluded from the BDEF derived types. This can be seen in the following screenshot: IMAGE suppress_field.png 291 162 ABAP_EXAMPLE_END