cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to override createEnable func at Sap Fiori Cds Annotations

Former Member
0 Kudos
293

Hi, experts.

I stuck with a problem i need to override a createEnable annotation at CDS.
I would dsescribe a mine problem.
At first screen i got a list of orders

Aftrer select on of orders it displays a list of materials in it

When i click create ( red rectangle it allows me to add a material in it)
It goes here and after clicking 'save' it will comeback to a second screen, and displays one more material

The problem is that user need to add materials one by one and it's difficult is he has a lot of materials to add.
So is it possible to add a table of previously added materials at third screen ?

Or to add to 2 input fields and a button 'add' at 2 screen ( above the table ) ?

Accepted Solutions (0)

Answers (1)

Answers (1)

AlexNecula
Active Contributor
0 Kudos

So is it possible to add a table of previously added materials at third screen ?

You can create an extension to the object page and add your custom fragment in there. The fragment should be linked to an entity that returns the last created materials.

Or to add to 2 input fields and a button 'add' at 2 screen ( under the table ) ?

This can become difficult. You would have to create an object page custom fragment and a custom control that extends the table and adds that functionality.

I suggest you to add a custom button that opens a dialog and let's the user upload a CSV or have 2 input fields and an "add" button. When ready, the user could press a "save" button then in the custom controller create the entries.

Former Member
0 Kudos

Can u please tell me which extension i need to create and what should i write there
Here's the code of nine 3rd screen CDS (as i understand ).

@AbapCatalog.sqlViewName: 'ZRA_CQ_ORD_IT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Consumption CDS for ZKO_I_T_ORDER_ITEM'
@OData.publish: true

@Metadata.allowExtensions: true

@ObjectModel:{
    transactionalProcessingDelegated: true,
    semanticKey: ['uuid'],
    representativeKey: 'uuid',
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true
}

@UI.presentationVariant: [{sortOrder: [{by: 'uuid',direction: #DESC }]}]
@UI.headerInfo: { typeName: 'Наименование',typeNamePlural: 'Наименование'}
@Search.searchable: true

define view ZRA_C_ORDER_ITEM
  as select from ZRA_I_T_ORDER_ITEM
  association [1..1] to ZKO_C_ORDER_HEAD as _headerdata on $projection.uuid_header = _headerdata.uuid 
{
  
//      @UI: {
//      lineItem: [{ type: #FOR_ACTION, position: 10,
//      dataAction: 'BOPF:ZRA_UPDATE',
//      label: 'Обновление' }],
      
//      identification: [{type: #FOR_ACTION,
//     position: 10,
//     dataAction: 'BOPF:ZRA_UPDATE',
//     label: 'Обновление' }]
//          }   
          
 
  
           @UI.lineItem: [    
//      { type: #FOR_ACTION, dataAction: 'BOPF:EXPORTVA02', label: 'Оформить' },
      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_UPDATE', label: 'Обновление' },
      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_ADD', label: '++' }      
//      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_COST_R', label: 'Расчет стоимости' }
//      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_DISPLAY', label: 'Вывод' }
    ]
    
           @UI.identification: [    
//      { type: #FOR_ACTION, dataAction: 'BOPF:EXPORTVA02', label: 'Оформить' },
        { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_UPDATE', label: 'Обновление' },  
        { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_ADD', label: '++' } 
//      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_UPDATE', label: 'Обновление' },
//      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_COST_R', label: 'Расчет стоимости' }
//      { type: #FOR_ACTION, dataAction: 'BOPF:ZRA_DISPLAY', label: 'Вывод' }
    ]
  
  
  
  
      @UI.hidden: true
  key uuid,

      @UI.hidden: true
      uuid_header,
      

      @UI.hidden: true
//     @UI.lineItem: { position: 5, importance: #HIGH }
      @ObjectModel.readOnly: true
      waers_s, 
  
      @UI.hidden: true
      @UI.lineItem: { position: 8, importance: #HIGH }
      @ObjectModel.readOnly: true
      cost_i,            

      @UI.lineItem: { position: 10, importance: #HIGH }
      @ObjectModel.readOnly: true
      @UI.hidden: true
      req_number,

      @UI.lineItem: {label:'Обозначение материала', position: 20, importance: #HIGH }
      @Search.defaultSearchElement: true
      @Search.ranking : #HIGH
//      @ObjectModel.readOnly: true  
     
     @Consumption.valueHelpDefinition: [{ entity:
             {name: 'ZRA_I_ORDER_ITEM_MATNR_SH' , element: 'matnr' }
//             additionalBinding: [{ localElement: 'matnr', element: 'matnr' }
//             additionalBinding: [{ localElement: 'maktx', element: 'maktx' }
//            { localElement: 'meins', element: 'meins' },
//             { localElement: 'cost', element: 'cost' },
//             { localElement: 'waers', element: 'waers' }
//             ]
            }]
      matnr,

      @UI.lineItem: { position: 30, importance: #HIGH }
      @ObjectModel.readOnly: true
      maktx,

      @UI.lineItem: { position: 40, importance: #HIGH }
      qnt,

      @UI.lineItem: { position: 50, importance: #HIGH }
      @ObjectModel.readOnly: true
      meins,

      @UI.lineItem: { position: 55, importance: #HIGH }
      @ObjectModel.readOnly: true
      cost,

 //     @UI.lineItem: { position: 60, importance: #HIGH }
      @ObjectModel.readOnly: true
      @UI.hidden: true
      waers,

      @UI.lineItem: { position: 70, importance: #HIGH }
      @ObjectModel.readOnly: true
      user_who_changed,

      @UI.lineItem: { position: 80, importance: #HIGH }
      @ObjectModel.readOnly: true
      date_changed,

      @UI.lineItem: { position: 90, importance: #HIGH }
      @ObjectModel.readOnly: true
      time_changed,

      @ObjectModel.association.type: [#TO_COMPOSITION_PARENT,#TO_COMPOSITION_ROOT]
      _headerdata,
      
      @Search.defaultSearchElement: true
        @ObjectModel.readOnly
        lower(maktx)                                                                                                                         as maktx_lower,
      @Search.defaultSearchElement: true
        @ObjectModel.readOnly
        Upper(maktx)                                                                                                                         as maktx_Upper,
      @Search.defaultSearchElement: true
        @ObjectModel.readOnly
        lower(matnr)                                                                                                                         as matnr_lower,
      @Search.defaultSearchElement: true
        @ObjectModel.readOnly
        Upper(matnr)                                                                                                                         as matnr_Upper        
      
}
AlexNecula
Active Contributor
0 Kudos

Check Adding Custom Actions Using Extension Points to add a custom button in the list report/object page.

From there, the implementation is completely up to you. For example, in the javascript function executed on button press, you can create a dialog with some input fields.

Former Member
0 Kudos

i've created this extension, it's itresting that if i put smth into targetElement ( id = "third" ) it will not display at all. But i still dont understand how to insert table here.

@Metadata.layer: #CUSTOMER
  @Search.searchable: true

annotate view ZRA_C_ORDER_ITEM with 
{
  @UI.facet: [
  {
                label : 'Наименование',
                id : 'Orders',
                purpose: #STANDARD,
                type : #COLLECTION,
                position: 10
            },
           {
                label:'',
                id : 'SecondFacet',
                purpose: #STANDARD,
                parentId : 'Orders',
                type : #FIELDGROUP_REFERENCE,
                targetQualifier : 'basic',
                position: 20
            },
            {
                label:'Other materials',
                id : 'Third',
                purpose: #STANDARD,
                type : #LINEITEM_REFERENCE,
                //targetQualifier : 'zko_c_orders',
                //targetElement: 'matnr',
                position: 30
            }
            ]



  @UI.hidden: true
  uuid;



  @UI.fieldGroup: [{ label: 'Обозначение материала',
                     qualifier: 'basic',
                     position: 10    }]
  @Search.defaultSearchElement: true
  @Search.ranking : #HIGH

  matnr;

  @UI.fieldGroup: [{ label: 'Название материала',
                 qualifier: 'basic',
                 position: 20   }]

  maktx;

  @UI.fieldGroup: [{ label: 'Количество',
               qualifier: 'basic',
               position: 30   }]

  qnt;

  @UI.hidden: false
  @UI.fieldGroup: [{ label: 'ЕИ',
                 qualifier: 'basic',
                 position: 40   }]
  meins;

  @UI.hidden: false
  @UI.fieldGroup: [{ label: 'Цена',
                 qualifier: 'basic',
                 position: 60   }]
  cost;

  @UI.hidden: false
  @UI.fieldGroup: [{ label: 'Валюта',
                 qualifier: 'basic',
                 position: 70   }]
  waers;

  @UI.hidden: false
  @UI.fieldGroup: [{ label: 'Валюта заказа',
                 qualifier: 'basic',
                 position: 70   }]
  waers_s;

}