Skip to Content
0
Nov 30, 2022 at 08:10 AM

ABAP RAP Unmanaged with draft header fields not editable

815 Views Last edit Nov 30, 2022 at 09:36 AM 3 rev

Hi *,

currently I'm developing an unmanaged ABAP RAP app with draft capability using early numbering. The business case is implementing a custom fiori app for SAP Retail Allocation Table which is still delivered as GUI transaction only.

However I managed to implement everything from CDS entities to behaviour definition, odata and fiori elements app finally.

When I create a new object the object page is loaded and I'm able to insert child elements, but the header fields aren't editable. When I change them to obligatory in BDEF I'll get an error right after pressing "Create" that the obligatory fields are missing. When I change fiori elements to creation via dialog the save routine is called although I'm not creating a real object but a draft.

Do you guys have any idea what I'm missing here?

image.png

unmanaged;
//strict;
with draft;


define behavior for ZI_AllocationTable
implementation in class zcl_pur_al_mng_alloctab unique
draft table ztb_alloctab
early numbering
lock master
total etag LastChangeDate
//authorization master ( global )
etag master LastChangeDate
{

//  field ( readonly ) AllocationTable, AllocTableActivityStatus, MaintenanceStatus, AllocTableCreatingApplication, CreatedByUser, CreationDate, LastChangeDate, LastChangedByUser;
//  field ( mandatory: create, readonly : update ) AllocationTableType, PurchasingOrganization, PurchasingGroup;

  create;
  update;
  //  delete;


  draft action Edit;
  draft action Activate;
  draft action Discard;
  draft action Resume;
  draft determine action Prepare;

  association _AllocationTableItem { create; with draft; }

//  mapping for AUKO
//  {
//
//    AllocTableActivityStatus =
//
//  }

}

define behavior for ZI_AllocationTableItem
implementation in class zcl_pur_al_mng_alloctabitem unique
draft table ztb_alloctabitm
//late numbering
lock dependent by _AllocationTable
//authorization dependent by _AllocationTable
//etag master <field_name>
{
//  create;
  update;
  delete;
  field ( readonly ) AllocationTable; // AllocationTableItem;
//  field ( mandatory ) Product;

  association _AllocationTable { with draft; }
  association _AllocationTableItemRcpnt { create; with draft; }
  association _AllocationTableItemRcpntGrp { create; with draft; }
}

define behavior for ZI_AllocationTableItemRcpnt
implementation in class zcl_pur_al_mng_alloctabitmrc unique
draft table ztb_alloctabitrc
//late numbering
lock dependent by _AllocationTable
//authorization dependent by _AllocationTable
//etag master <field_name>
{
  update;
  delete;
  field ( readonly ) AllocationTable, AllocationTableItem;
  association _AllocationTableItem { with draft; }
  association _AllocationTable { with draft; }
}

define behavior for ZI_AllocationTableItemRcpntGrp
implementation in class zcl_pur_al_mng_alloctabitmrcgr unique
draft table ztb_alloctabitrg
//late numbering
lock dependent by _AllocationTable
//authorization dependent by _AllocationTable
//etag master <field_name>
{
  update;
  delete;
  field ( readonly ) AllocationTable, AllocationTableItem;
  association _AllocationTableItem { with draft; }
  association _AllocationTable { with draft; }
}<br>

Thanks for your help!

UPDATE:

It's somehow related to the value help annotations in consumption view:

Only if I use this one, the field is editable and displayed with the value help.

          @Consumption.valueHelpDefinition: [{ 
          entity: {
              name: 'I_AllocationTableType',
              element: 'AllocationTableType'
          } }]

Using @Consumption.valueHelp: '<assoc>' or @ObjectModel. @ObjectModel.foreignKey.association: '<assoc>' makes the field read only.

Kind regards,

Christian

Attachments

image.png (44.8 kB)