ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - Managed and Unmanaged Behavior Definitions → RAP - EntityBehaviorDefinition → RAP - EntityBehaviorBody → RAP - RAP BO Operations → RAP - RAP BO Operation, Additions → 

    RAP - internal

    Syntax


    ... internal ...

    Description


    Defines a RAP BO operation as internal. That means that the operation in question can only be accessed from within the ABAP behavior pool, for example from an action, a validation, or a determination. When an external RAP BO consumer tries to execute an internal RAP BO operation, a runtime error occurs.

    internal can be applied to the following operations:

    This feature is provided by the RAP framework. No implementation in the ABAP behavior pool is required.

    Hints

    • If an operation is marked as internal, feature control is not supported. Feature control is for external access control and is not required for internal operations.
    • precheck is not available for internal operations.
    • authorization:update, authorization:global, and authorization:instance are not available for internal operations.
    • Internal operations cannot be reused with the keyword use in a projection BDEF or in an interface BDEF, because they are not visible there.

    Example


    The following example shows a managed BDEF that defines the internal action calculateTotalAmount and the on modify determination calcTotal.

    managed implementation in class bp_demo_rap_internal unique;
    strict(2);

    define behavior for DEMO_RAP_INTERNAL alias RootEntity
    persistent table demo_dbtab_field
    lock master
    authorization master (global)
    {
      create;
      update;
      delete;

      field(numbering:managed, readonly) KeyField;

      internal action calculateTotalAmount;

      determination calcTotal on modify { create; }

      mapping for demo_dbtab_field
      {
        KeyField = key_field;
        CharField = char_field1;
        Amount = int_field1;
        Quantity = int_field2;
        Total = int_field3;
      }
    }

    The internal action multiplies the value of field Quantity with the value of field Amount and inserts the result into field Total per entity instance. It is executed from the ABAP behavior pool by the on modify determination calcTotal.

    Code snippet: determination that triggers the internal action:

    METHOD calcTotal. 
     
      MODIFY ENTITIES OF demo_rap_internal IN LOCAL MODE
          ENTITY RootEntity
            EXECUTE calculateTotalAmount
              FROM CORRESPONDING #( keys )
              REPORTED DATA(lt_reported).
     
    ENDMETHOD.

    For the full ABAP behavior pool implementation, see BP_DEMO_RAP_INTERNAL==========CCIMP.

    The ABAP class CL_DEMO_RAP_INTERNAL uses EML to access the RAP business object:

    • It creates five new entity instances by specifying values for the  fields Amount and Quantity.
    DELETE FROM demo_dbtab_field. 
        MODIFY ENTITIES OF demo_rap_internal
           ENTITY RootEntity
           CREATE FIELDS ( Amount Quantity Total ) WITH VALUE #(
           ( %cid = '1' Amount = 16  Quantity = 1 )
           ( %cid = '2' Amount = 211 Quantity = 2 )
           ( %cid = '3' Amount = 3   Quantity = 3 )
           ( %cid = '4' Amount = 18  Quantity = 4 )
           ( %cid = '5' Amount = 10  Quantity = 5 ) )
              MAPPED FINAL(mapped)
              FAILED  FINAL(failed)
              REPORTED FINAL(reported).
        COMMIT ENTITIES.

    • Using the ABAP SQL SELECT statement, the content of the underlying database table is displayed.

    Result: for each entity instance, the value of the field Total is calculated.

    figure