Ansicht
Dokumentation

ABENBDL_SAVING - BDL SAVING

ABENBDL_SAVING - BDL SAVING

BAL_S_LOG - Application Log: Log header data   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

- Saving Options

... ${with additional save $[and cleanup$]$[with full data$]$}
  $| ${with unmanaged save $[and cleanup$]$[with full data$]$} ...


Variants:

1. ... with additional save $[and cleanup$]$[with full data$]

2. ... with unmanaged save $[and cleanup$]$[with full data$]

Additions

1. ... and cleanup

2. ... with full data

Effect

The syntax additions described in this topic are available only in a managed RAP BO.

The additions with additional save and with unmanaged save can be used to enhance or to replace the default save sequence in a managed RAP BO. Per default, the RAP framework performs a managed save. With an additional save, you can add steps to the managed save. An unmanaged save prevents the default and allows you to implement your own saving strategy. Both additions require a reimplementation of the save_modified method of the RAP saver class in the ABAP behavior pool.

When one of the additions with additional save or with unmanaged save is specified, per default, only the values of key fields and changed fields are handed over to the save_modified method of the RAP saver class. The addition with full data can be used to hand over the full instance data - that means, the values of all fields that are part of the component group %data - to the save_modified method. Further details are described below.

There are two options for notation:

  • In the BDEF header, directly after the keyword managed. In this case, the additional save or unmanaged save is enabled for all entities of the business object.
Example: managed with additional save implementation in class ...;

Example

The following example shows a managed BDEF that defines an additional save in the BDEF header.

In the ABAP behavior pool, the method save_modified tracks data changes in a log table. The complete implementation can be seen in the BP_DEMO_MANAGED_ADDITIONAL_SAVCCIMP.

The ABAP program DEMO_RAP_MANAGED_ADD_SAVE uses EML to access the RAP business object. It performs a create, update, and delete operations. The changes are saved and tracked in internal log tables.

The example shown above is displayed and explained in detail in topic ABAP EML - TYPE REQUEST FOR in a managed RAP BO with additional save.



Variant 1

... with additional save


Effect

Allows you to invoke additional functionality during the standard save sequence, for example, change documents and an application log.

An implementation in the local saver class is required.

Development guide for the ABAP RESTful Application Programming Model, section about Additional Save.

Variant 2

... with unmanaged save


Effect

Prevents the BO's managed runtime from saving changes and allows you to implement an own saving strategy instead. In case of an unmanaged save, a persistent table cannot be specified.

An implementation in the local saver class is required.

An example for a managed RAP BO with unmanaged save is shown in topic ABAP EML - TYPE REQUEST FOR in a managed RAP BO with unmanaged save.

Development guide for the ABAP RESTful Application Programming Model, section about Unmanaged Save.

Addition 1

... and cleanup

Effect

If specified, the RAP saver method cleanup must be redefined.

Addition 2

... with full data

Effect

If specified, then the full instance data is handed over to the save_modified method of the RAP saver class in the ABAP behavior pool. In other words, all fields that are part of the component group %data are filled with values when the save_modified method is called.

Notes

  • The fields of the component group %control are not affected by this. Still, only the changed fields of %control are flagged.
  • In scenarios where all fields, not only changed fields, are required for further processing, the addition with full data can be used. This spares the RAP BO consumer an additional READ operation.

Example

The following example shows a managed BDEF that defines an additional save with full data in the BDEF header.

In the ABAP behavior pool, the method save_modified tracks data changes in a log table. The complete implementation can be seen in the BP_DEMO_MANAGED_ADDITIONAL_SAVCCIMP.

The ABAP program DEMO_RAP_MANAGED_FULL_DATA uses EML to access the RAP business object. First, it creates two entity instances, filling values into all entity fields. Then, it updates both entity instances, changing the values of two fields, namely field1 and field2. Without the addition with full data, only the values of the changed fields are considered in the save_modified method. The fields that are not changed have their initial value. But since this example uses with full data, even the values of fields field3 and field4 are considered.

Code Snippet: Note that field3 and field4 are not updated.

Variable lt_update in the ABAP behavior pool when the addition with full data is specified: all fields are listed with their values, even the fields which are not included in the update operation.

IMAGE @@with_full_data.png@@567@@64@@

Variable lt_update in the ABAP behavior pool when the addition with full data is not specified: fields that are not updated are filled with initial values.

IMAGE @@without_full_data.png@@520@@66@@

In this example, fields that are not updated are filled with initial values. Please note that this is not always the case. Fields which are not updated do not contain consistent values and the values must therefore not be evaluated.






General Material Data   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 11272 Date: 20240426 Time: 064539     sap01-206 ( 155 ms )