Thursday, June 18, 2026

RAP8: Early numbering

  • In this post will show you how to use early numbering.
  • Step 1: Add early numbering key word in interface behavior definition and activate behavior definition.

















    • Working with early numbering make key field in Read only 
  • Step 2: Click on information to create early numbering method in behavior implementation as showin below:






















  • Step 3:
  • Step 4:
  • Step 5:
  • Step 6:
  • Step 7:
  • Step 8:

RAP 7: Draft functionality in RAP

  • In this post will show you how to create Draft functionality in RAP Application.
  • Step 1: Open the Interface view behavior definition and add key workd as with Drft , draft table and create draft table, total etag, with draft into create  as show in below:














































    • Interface view Behavior definition code:
    • managed;

      strict ( 2 );

      with draft;


      define behavior for ZR_SALESORDER_HEAD_M alias Header

      implementation in class zbp_r_salesorder_head_m unique

      persistent table zms_sales_head

      draft table zdt_sales_head

      lock master

      total etag LastChangedAt

      authorization master ( instance )

      etag master LastChangedAt

      {

      create ( authorization : global );

      update;

      delete;

      field ( readonly ) SalesOrder, Ernam, LastChangedAt;

      association _Item { create; with draft; }


      draft action Activate optimized;

      draft determine action Prepare;

      draft action Edit;

      draft action Resume;

      draft action Discard;


      mapping for zms_sales_head //db table name

      {


      //CDS View field //DB Table field name

      SalesOrder = vbeln;

      DocumentDate = audat;

      OrderType = auart;

      SalesOrganization = vkorg;

      DistributionChannel = vtweg;

      Division = spart;

      Erdat = erdat;

      Erzet = erzet;

      Ernam = ernam;

      LastChangedAt = lastchanged;

      }

      }

      define behavior for ZI_SALESORDER_ITEM_M alias Item

      implementation in class zbp_i_salesorder_item_m unique

      persistent table zms_sales_item

      draft table zdt_sales_item

      lock dependent by _Head

      authorization dependent by _Head

      etag dependent by _Head

      {

      update;

      delete;

      field ( readonly ) SalesOrder, Item;


      association _Head {with draft;}

      mapping for zms_sales_item //db table name

      {


      //CDS View field //DB Table field name

      SalesOrder = vbeln;

      Item = posnr;

      Material = matnr;

      MaterialDescription = arktx;

      Quantity = kwmeng;

      Unit = vrkme;

      Netpr = netpr;

      Currency = waerk;

      }

      }

  • Step 2: Creation of draft table: Write the “draft table <Table Name> and place the cursor on the table name and quick the shortcut as “Clrl+Shift+1, it shows shortcut popup, click on Create table

    • Header Draft table



















    • Item Draft table



















  • Step 3: Open the projection view behavior definition and write brloe code























    • Projection view Behavior definition code:
    • projection;

      strict ( 2 );

      use draft;


      define behavior for ZC_SALESORDER_HEAD_M alias Header

      use etag

      {

      use create;

      use update;

      use delete;

      use association _Item { create; with draft; }


      use action Edit;

      use action Activate;

      use action Discard;

      use action Prepare;

      use action Resume;

      }


      define behavior for ZC_SALESORDER_ITEM_M alias Item

      use etag

      {

      use update;

      use delete;


      use association _Head{ with draft; }

      }


  • Step 4: Output:
  •  






Friday, June 12, 2026

RAP 6: ETag

  •  In this post show will work with Etag in RAP.
  • ETag with Manage Application
    • Step 1: If you don't have timestamp  field in your custom table then kinldy created timestamp field 

















    • Step 2: Add created timestamp field into your Interface view with annotation



















    • Interface view Code:
    • @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'Root View for Sales order Head'

      @Metadata.ignorePropagatedAnnotations: true

      define root view entity ZR_SALESORDER_HEAD_M

      as select from zms_sales_head as Head

      composition [0..*] of ZI_SALESORDER_ITEM_M as _Item

      {

      key vbeln as SalesOrder,

      audat as DocumentDate,

      auart as OrderType,

      vkorg as SalesOrganization,

      vtweg as DistributionChannel,

      spart as Division,

      erdat as Erdat,

      erzet as Erzet,

      @Semantics.user.localInstanceLastChangedBy: true

      ernam as Ernam,

      @Semantics.systemDateTime.localInstanceLastChangedAt: true

      lastchanged as LastChangedAt,

      _Item

      }

    • Step 3: Add timestamp field into the Projection view




















    • Projection view code:
    • @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'ProjectionView for Sales order Header'

      @Metadata.ignorePropagatedAnnotations: true

      @Metadata.allowExtensions: true

      define root view entity ZC_SALESORDER_HEAD_M

      provider contract transactional_query

      as projection on ZR_SALESORDER_HEAD_M

      {

      key SalesOrder,

      DocumentDate,

      OrderType,

      SalesOrganization,

      DistributionChannel,

      Division,

      Erdat,

      Erzet,

      Ernam,

      LastChangedAt,

      _Item : redirected to composition child ZC_SALESORDER_ITEM_M

      }

    • Step 4: Add etag to your Interface behavior definition, when we define etage for the perticular field then alway make that field in read only.



































    • Interface behavior definition code
    • managed implementation in class zbp_r_salesorder_head_m unique;

      strict ( 2 );


      define behavior for ZR_SALESORDER_HEAD_M alias Header

      persistent table zms_sales_head

      lock master

      authorization master ( instance )

      etag master LastChangedAt

      {

      create ( authorization : global );

      update;

      delete;

      field ( readonly ) SalesOrder, Ernam, LastChangedAt;

      association _Item { create; }

      mapping for zms_sales_head //db table name

      {


      //CDS View field //DB Table field name

      SalesOrder = vbeln;

      DocumentDate = audat;

      OrderType = auart;

      SalesOrganization = vkorg;

      DistributionChannel = vtweg;

      Division = spart;

      Erdat = erdat;

      Erzet = erzet;

      Ernam = ernam;

      LastChangedAt = lastchanged;

      }

      }

      define behavior for ZI_SALESORDER_ITEM_M alias Item

      persistent table zms_sales_item

      lock dependent by _Head

      authorization dependent by _Head

      etag dependent by _Head

      {

      update;

      delete;

      field ( readonly ) SalesOrder, Item;


      association _Head;

      mapping for zms_sales_item //db table name

      {


      //CDS View field //DB Table field name

      SalesOrder = vbeln;

      Item = posnr;

      Material = matnr;

      MaterialDescription = arktx;

      Quantity = kwmeng;

      Unit = vrkme;

      Netpr = netpr;

      Currency = waerk;

      }

      }

    • Step5: Add etage in Projection behavior


















    • Projection Behavior definition code
    • projection;

      strict ( 2 );


      define behavior for ZC_SALESORDER_HEAD_M alias Header

      use etag

      {

      use create;

      use update;

      use delete;

      use association _Item { create; }

      }


      define behavior for ZC_SALESORDER_ITEM_M alias Item

      use etag

      {

      use update;

      use delete;


      use association _Head;

      }


  • ETag with Unmanage Application => Comming soon

Sunday, June 7, 2026

RAP 5: Manage Scenario

  •  In this post will create Manage Scenario complete application for Create, Modify and Delete Records.
  • Step 1: Create Custom Header and Item table:
    • Custom Header Table 

























    • Custom Item Table details
  • Step 2: Create Iinterface view for the Header and Item CDS View and establish a connection between the header and item CDS View.  Please refer to RAP 1 and RAP 2 for guidance on creating the interface view:
    • Header Interface CDS view:



















    • Header Interface view Code:
    • @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'Root View for Sales order Head'

      @Metadata.ignorePropagatedAnnotations: true

      define root view entity ZR_SALESORDER_HEAD_M

      as select from zms_sales_head as Head

      composition [0..*] of ZI_SALESORDER_ITEM_M as _Item

      {

      key vbeln as SalesOrder,

      audat as DocumentDate,

      auart as OrderType,

      vkorg as SalesOrganization,

      vtweg as DistributionChannel,

      spart as Division ,

      erdat as Erdat,

      erzet as Erzet,

      ernam as Ernam,

      _Item

      }

    • Item Interface CDS View: 


    • Item Interface view Code:
    • @AbapCatalog.viewEnhancementCategory: [#NONE]

      @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'Interface View for Sales order Item'

      @Metadata.ignorePropagatedAnnotations: true

      define view entity ZI_SALESORDER_ITEM_M

      as select from zms_sales_item as Item

      association to parent ZR_SALESORDER_HEAD_M as _Head on $projection.SalesOrder = _Head.SalesOrder

      {

      key vbeln as SalesOrder,

      key posnr as Item,

      matnr as Material,

      arktx as MaterialDescription,

      @Semantics.quantity.unitOfMeasure: 'Unit'

      kwmeng as Quantity,

      vrkme as Unit,

      @Semantics.amount.currencyCode: 'Price'

      netpr as Netpr,

      waerk as Price,

      _Head

      }

  • Step 3: Create Behavior definition on the Interafce Root view, Right Click on Interface Root View and select Behavior definition
  • Step 4: Provide Behavior definition description and select Implementation Type as "Managed"
  • Step 5: We can see the Behavior definition is created as below, Activate Behavior definition 








































  • Step 6:  Implement the Behavior definition, Click on Information and click on "Create behavior implementation class" 


  • Step 7: Provide the Behavior implementation description and click on Next


  • Step 8: Activate Behavior Implementation 
  • Step 9: Create Projection view for Sales Order Header CDS view and Sales order Item CDS view. Also define the relation between header and item in projection view.
    • Note: If you want to know how to create Projection view, Kindly refer the link from Step 5 to Step 7.


    • Projection view for Sales Order Header code
    • @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'ProjectionView for Sales order Header'

      @Metadata.ignorePropagatedAnnotations: true

      define root view entity ZC_SALESORDER_HEAD_M

      as projection on ZR_SALESORDER_HEAD_M

      {

      key SalesOrder,

      DocumentDate,

      OrderType,

      SalesOrganization,

      DistributionChannel,

      Division,

      Erdat,

      Erzet,

      Ernam,

      _Item : redirected to composition child ZC_SALESORDER_ITEM_M

      }

    • Projection View for Sales order Item Code
    • @AccessControl.authorizationCheck: #NOT_REQUIRED

      @EndUserText.label: 'ProjectionView for Sales order Item'

      @Metadata.ignorePropagatedAnnotations: true

      define view entity ZC_SALESORDER_ITEM_M

      as projection on ZI_SALESORDER_ITEM_M

      {

      key SalesOrder,

      key Item,

      Material,

      MaterialDescription,

      @Semantics.quantity.unitOfMeasure: 'Unit'

      Quantity,

      Unit,

      @Semantics.amount.currencyCode: 'Price'

      Netpr,

      Price,

      _Head : redirected to parent ZC_SALESORDER_HEAD_M

      }

  • Step 10: Create Behavior Definition on the Projection view, Right click on Sales order Header Projection view and click on the Behavior definition, provide the Description and select the Implementation Type as "Projection". Click on Next and finish.


























  • Step 11:  Behavior Definition is created for Projection view as below:




















  • Step 12:  Create Metadata Extension on the Projection View
    • First add the annotation @Metadata.allowExtensions: true in bothe Sales order Header and Sales order Item Projection view 
    • Note: If you want to know how to create Metadata Extension, Kindly refer the link and follow the after Step 15 process. 
    • Sales Order Header Extension view code:
    • @Metadata.layer: #CORE

      @UI.headerInfo: { typeName: 'Sales Order Manage',

      typeNamePlural: 'Sales Order Manage Application' }

      annotate entity ZC_SALESORDER_HEAD_M with

      {

      @UI.facet: [{ id: 'SalesHeader',

      purpose: #STANDARD,

      position: 10,

      label: 'Sales Order Header',

      type: #IDENTIFICATION_REFERENCE },

      { id: 'SalesItem',

      purpose: #STANDARD,

      position: 20,

      label: 'Sales Order Item',

      type: #LINEITEM_REFERENCE,

      targetElement: '_Item' } ]


      @UI: { lineItem: [{ position: 10, label: 'Sales Order Number' }],

      selectionField: [{ position: 10 }],

      identification: [{ position: 10, label: 'Sales Order Number' }] }

      SalesOrder;


      @UI: { lineItem: [{ position: 20, label: 'Document Date' }],

      selectionField: [{ position: 20 }],

      identification: [{ position: 20, label: 'Document Date' }] }

      DocumentDate;


      @UI: { lineItem: [{ position: 30, label: 'Order Type' }],

      selectionField: [{ position: 30 }],

      identification: [{ position: 30, label: 'Order Type' }] }

      OrderType;


      @UI: { lineItem: [{ position: 40, label: 'Sales Organization' }],

      selectionField: [{ position: 40 }],

      identification: [{ position: 40, label: 'Sales Organization' }] }

      SalesOrganization;


      @UI: { lineItem: [{ position: 50, label: 'Distribution Channel' }],

      selectionField: [{ position: 50 }],

      identification: [{ position: 50, label: 'Distribution Channel' }] }

      DistributionChannel;


      @UI: { lineItem: [{ position: 60, label: 'Division' }],

      selectionField: [{ position: 60 }],

      identification: [{ position: 60, label: 'Division' }] }

      Division;

      @UI.hidden: true

      Erdat;

      @UI.hidden: true

      Erzet;

      @UI.hidden: true

      Ernam;


      }

    • Sales Order Item Extension view code:
    • @Metadata.layer: #CORE

      annotate entity ZC_SALESORDER_ITEM_M with

      {

      @UI.facet: [{ id: 'SalesItem',

      purpose: #STANDARD,

      position: 10,

      label: 'Sales Order Itemr',

      type: #IDENTIFICATION_REFERENCE }]


      @UI: { lineItem: [{ position: 10, label: 'Sales order Number' }],

      identification: [{ position: 10 }] }

      SalesOrder;


      @UI: { lineItem: [{ position: 20, label: 'Order Item' }],

      identification: [{ position: 20, label: 'Sales Order Item' }] }

      Item;


      @UI: { lineItem: [{ position: 30, label: 'Material' }],

      identification: [{ position: 30, label: 'Material' }] }

      Material;


      @UI: { lineItem: [{ position: 40, label: 'Material Description' }],

      identification: [{ position: 40, label: 'Material Description' }] }

      MaterialDescription;


      @UI: { lineItem: [{ position: 50, label: 'Quantity' }],

      identification: [{ position: 50, label: 'Quantity' }] }

      Quantity;


      @UI: { identification: [{ position: 60, label: 'Unit' }] }

      Unit;


      @UI: { lineItem: [{ position: 60, label: 'Amount' }],

      identification: [{ position: 70, label: 'Amount' }] }

      Netpr;


      @UI: { identification: [{ position: 80, label: 'Currency' }] }

      Currency;

      }

  • Step 13: Create Service Definition, Right click on Sales Order Header Projection view (Consumption view) and select the Service Definition 
















  • Step 14: Provide Service Definition Name and Description
























  • Step 15: Also expose  the Sales Order Item consuption view








  • Step 16: Create Service Binding, Right click on Service Definition and Select Service Binding 










  • Step 17: Provide Service Binding Name, Description and Select Binding Type as OData V2, (as we have not created Draf functionality so OData V4 is not working)


























  • Step 18: Service Binding is created as below, Kinldy Publish the service and activate service again.
















  • Step 19: Kinldy See the Result in UI 




RAP8: Early numbering

In this post will show you how to use early numbering . Step 1: Add early numbering key word in interface behavior definition and activate b...