ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - BDEF Extension → RAP - Base BDEF Extension → RAP - extension → RAP - EntityBehaviorExtension → RAP - ExtensionBody → RAP - Extending Elements → 

    RAP - extend determine action

    Syntax


    extend determine action DetermineActionName
              {
               determination [(always)] MyDetermination1;
               determination [(always)] MyDetermination2;
               validation [(always)] MyValidation1;
               validation [(always)] MyValidation2;
               determination [(always)] Child~ChildDetermination;
               validation [(always)] Child~ChildValidation;
               ...
              }

    Prerequisites


    Description


    Extends an existing determine action DetermineActionName with extension determinations and extension validations. At least one extension determination or extension validation must be specified within curly brackets.

    If the optional addition always is used, then all determinations and validations that are part of the determine action are executed regardless of their trigger conditions. After a determination with the flag always has been executed, it can be triggered again by other determinations belonging to the same determine action.

    Determinations and validations of child entities can be included using the syntax child~childDetermination or child~childValidation, as long as these validations and determinations do not include the trigger operation delete.

    Execution order: Determinations are executed first, validations afterwards. The execution order among determinations or validations themselves is defined by the RAP framework and is independent of the specified order within the determine action.

    RAP authorization control from the extended BDEF is reused, if specified.

    Limitation: Extensions for determine actions are currently not supported in unmanaged RAP BOs.

    Hint

    Internal determine actions cannot be extended.

    Related Information

    Example


    The following source code shows BDEF extension DEMO_RAP_DET_ACT_EXT. It extends BDEF DEMO_RAP_EXTENSIBILITY_DET_ACT by adding one further determination setStatustoNew to the determine action trigger_all.

    The original BDEF explicitly allows extensions to the determine action trigger_all:

    managed implementation in class bp_demo_rap_extensibility_det_ unique;
    strict(2);
    extensible
    { with determinations on modify;
      with determinations on save;
      with validations on save; }
    with draft;

    define behavior for DEMO_RAP_EXTENSIBILITY_DET_ACT alias Root
    persistent table demo_sales_order
    draft table demo_sales_draft
    lock master
    total etag LastChangedAt
    authorization master ( instance )
    extensible
    {
      create;
      update;
      delete;
      association _child { create; with draft; }
      field(readonly:update) SoKey;
      field ( readonly ) LastChangedAt;

      draft action Activate optimized;
      draft action Discard;
      draft action Edit;
      draft action Resume;

      draft determine action Prepare extensible
      { determination (always) setID; }

      determination setID on save { create; }

    determine action trigger_all extensible
      {
        determination ( always ) setID;
        determination ( always ) Child ~ TotalPrice;
      }

      mapping for DEMO_SALES_ORDER corresponding extensible
      {
        SoKey = so_key;
        SalesOrderId = id;
        BuyerId = buyer_id;
        Status = lifecycle_status;
        ShipToId = ship_to_id;
        QuantitySum = quantity_sum;
        UomSum = uom_sum;
        AmountSum = amount_sum;
        CurrencySum = currency_sum;
        CompanyCode = company_code;
        CreatedBy = created_by;
        CreatedOn = created_on;
        CreatedAt = created_at;
        LastChangedBy = last_changed_by;
        LastChangedOn = last_changed_on;
        LastChangedAt = last_changed_at;
      }
    }

    define behavior for DEMO_RAP_EXT_DET_ACT_CHILD alias Child
    persistent table demo_sales_so_i
    draft table sales_i_draft
    lock dependent by _parent
    authorization dependent by _parent
    {
      update;
      delete;

      field ( readonly : update ) ParentKey, SoItemKey;

      determination TotalPrice on save { create; }

      association _parent { with draft; }

      mapping for DEMO_SALES_SO_I corresponding
      {
        SoItemKey = so_item_key;
        ParentKey = parent_key;
        GrossAmount = gross_amount;
      }
    }

    The extension adds one further determination setStatustoNew to the determine action trigger_all:

    extension using interface DEMO_RAP_EXT_DET_ACT_INT
    implementation in class bp_demo_rap_det_act_ext unique;

    extend behavior for Root
    {
      determination setStatustoNew on save { create; }

      extend determine action trigger_all
      {
        determination (always) setStatustoNew;
      }
    }

    The ABAP class CL_DEMO_CDS_EXT_DET_ACT uses EML to access to RAP business object. It executes the determine action trigger_all.

    The RAP framework executes the implementations in the original and extension ABAP behavior pools in the following order:

    • get_instance_authorizations: check whether the operation on the root node is authorized.
    • setID, a determination from the root node of the original BDEF.
    • setStatustoNew, a determination from the root node extension.
    • get_instance_authorizations: check whether the operation on the child node is authorized.
    • TotalPrice, a determination from the child node of the original BDEF.

    Executable Example


    The example above is explained in detail in the executable example RAP - Extend Determine Action.

    Continue