domingo, 29 de agosto de 2021

CDS view - Search help com descrição do texto

 Exemplo, descrição do material

Importante  lembrar de colocar a categoria de dados e a semantica de texto


@AbapCatalog.sqlViewName: 'ZDDV_CDS_SZK_T8'

@AbapCatalog.compiler.compareFilter: true

@AbapCatalog.preserveKey: true

@ObjectModel.dataCategory: #TEXT

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'Material'

@OData.publish: true


define view ZDD_CDS_SZK_T8 as select from makt

 {

 key matnr as CodMat,

      @Semantics.text: true

      @EndUserText.label: 'Descrição'

      cast(maktx as abap.char(30)) as Mattxt


} where spras = $session.system_language


--- Na view principal

define view ZDD_CDS_SZK_T3

  as select from vbak as A

  association [1..*] to zdd_cds_szk_t6 as _ItemOV   on $projection.DocVen = _ItemOV.Vbeln

  association [1]    to ZDD_CDS_SZK_T4 as _SalesOrg on $projection.OrgVen = _SalesOrg.SalesOrganization

  association [1] to ZDD_CDS_SZK_T7 as _ItemOVSum   on $projection.DocVen = _ItemOVSum.Vbeln

  association [1] to ZDD_CDS_SZK_T8 as _MatF4  on $projection.CodMat = _MatF4.CodMat

{


      @UI.facet: [

      {

      id: 'Info',

      type: #DATAPOINT_REFERENCE,

      purpose: #HEADER,

      position: 10,

      qualifier: 'OrgVenda'

       },

       -- facet de corpo

       {

      id: 'Dados',

      label: 'Info geral',

      type: #COLLECTION,

      purpose: #STANDARD,

      position: 10

       },

       {

      label: 'Dados NF',

      type: #IDENTIFICATION_REFERENCE,

      purpose: #STANDARD,

      position: 10,

      parentId: 'Dados'

       },

       {

       id: 'Item',

       type: #LINEITEM_REFERENCE,

       purpose: #STANDARD,

       targetElement: '_ItemOV',

       position: 20

       }


       ]

     

      @ObjectModel.text.association: '_MatF4'

     

      @UI.lineItem: [{ position: 10 }]

  key A.vbeln                            as DocVen,

      @UI.lineItem: [{ position: 30 }]

      @UI.selectionField: [{position: 30}]

      @ObjectModel.foreignKey.association: '_SalesOrg'

      @Consumption.filter: { selectionType: #RANGE, multipleSelections: true }

      @UI.dataPoint: { qualifier: 'OrgVenda', title: 'Organização de vendas' }

      A.vkorg                            as OrgVen,

      @UI.lineItem: [{ position: 40 }]

      @UI.selectionField: [{position: 40}]

      @UI.dataPoint: { title: 'Canal de distribuição' }

      A.vtweg                            as CanDist,

      @UI.lineItem: [{ position: 50 }]

      @UI.selectionField: [{position: 50}]

      @UI.identification: [{ position: 10 }]

      A.spart                            as SetAtiv,

      @UI.dataPoint: { title: 'Cliente' }

      A.kunnr                            as CodCli,

      @UI.hidden: true

      A.auart                            as TpOV,

      (concat('Doc.Venda :', A.vbeln ) ) as TxtDoc,

      case  

      when _ItemOVSum.SomaTotal < 10 then 1

      else 3 

      end as StatusCor,

      @UI.lineItem: [{ position: 60 },

                     { criticality: 'StatusCor', value: 'TotalQtd' }]

      _ItemOVSum.SomaTotal as TotalQtd,      

       

      _ItemOVSum.totitem as TotItem,             

      

     @UI.selectionField: [{position: 50}]  

      @ObjectModel.foreignKey.association: '_MatF4'

      @Search.defaultSearchElement: true

      --@Consumption.filter: { selectionType: #RANGE, multipleSelections: true }

      _ItemOV.Matnr as CodMat,

             

      _ItemOV,

      _ItemOVSum,

      _SalesOrg,

      _MatF4

      

}



Nenhum comentário:

Postar um comentário