cancel
Showing results for 
Search instead for 
Did you mean: 

SAP FIORI OVP tutorial with cds : numbers not displayed.

Guillaume2
Participant
0 Kudos

Hello all (gurus and others)...

I have followed the excellent blog from Jamie Cawley  at :http://scn.sap.com/community/developer-center/front-end/blog/2016/07/05/creating-a-fiori-ovp-applica...

everything is working perfectly, except that when i run the app I do not get the numbers displayed :


My CDS View is defined as :

@AbapCatalog.sqlViewName: 'zovpdemo1'

@AbapCatalog.compiler.compareFilter: true

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'OVP Demo App on Gateway'

@OData.publish: true

define view Z_Ovp_Demo1 as select from sepm_cds_sales_order as so {

key so.sales_order_key,

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

    @UI.lineItem: { position: 10, qualifier:'ordOverView', label: 'Sales Order'  } 

so.sales_order_id,

so.created_by, 

so.created_at, 

so.changed_by, 

so.changed_at, 

so.note_guid, 

so.currency_code, 

so.gross_amount,

    @UI.lineItem:  { position: 30, qualifier:'ordOverView', label: 'Net Amount'}   

so.net_amount, 

so.tax_amount, 

so.lifecycle_status, 

so.billing_status, 

so.delivery_status, 

so.buyer_guid, 

/* Associations */ 

so.customer, 

so.items,

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

    @UI.lineItem:  { position: 20, qualifier:'ordOverView', label: 'Customer' } 

so.customer.company_name 

}

My manisfest.json :

"sap.ovp": {

  "_version": "1.1.0",

  "globalFilterModel": "Z_OVP_DEMO1_CDS",

  "globalFilterEntityType": "Z_Ovp_Demo1Type",

  "cards": {

  "com.demo_card00": {

  "model": "Z_OVP_DEMO1_CDS",

  "template": "sap.ovp.cards.table",

  "settings": {

  "title": "{{com.demo_card00_title}}",

  "subTitle": "{{com.demo_card00_subTitle}}",

  "entitySet": "Z_Ovp_Demo1",

  "addODataSelect": "false",

  "annotationPath": "com.sap.vocabularies.UI.v1.LineItem#ordOverView"

  }

  }

  }

  },

my metadata.xml includes :

<EntityType Name="Z_Ovp_Demo1Type" sap:label="OVP Demo App on Gateway" sap:content-version="1">

                <Key>

                    <PropertyRef Name="sales_order_key"/>

                </Key>

                <Property Name="sales_order_key" Type="Edm.Guid" Nullable="false" sap:label="Node Key"/>

                <Property Name="sales_order_id" Type="Edm.String" MaxLength="10" sap:display-format="UpperCase" sap:label="Sales Order ID"/>

                <Property Name="created_by" Type="Edm.Guid" sap:label="Node Key"/>

                <Property Name="created_at" Type="Edm.DateTimeOffset" Precision="7" sap:label="Created At"/>

                <Property Name="changed_by" Type="Edm.Guid" sap:label="Node Key"/>

                <Property Name="changed_at" Type="Edm.DateTimeOffset" Precision="7" sap:label="Changed At"/>

                <Property Name="note_guid" Type="Edm.Guid" sap:label="Node Key"/>

                <Property Name="currency_code" Type="Edm.String" MaxLength="5" sap:label="Currency Code" sap:semantics="currency-code"/>

                <Property Name="gross_amount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="currency_code" sap:label="Gross Amount"/>

                <Property Name="net_amount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="currency_code" sap:label="Net Amount"/>

                <Property Name="tax_amount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="currency_code" sap:label="Tax Amount"/>

                <Property Name="lifecycle_status" Type="Edm.String" MaxLength="1" sap:display-format="UpperCase" sap:label="Lifecycle Status"/>

                <Property Name="billing_status" Type="Edm.String" MaxLength="1" sap:display-format="UpperCase" sap:label="Confirmation Status"/>

                <Property Name="delivery_status" Type="Edm.String" MaxLength="1" sap:display-format="UpperCase" sap:label="Ordering Status"/>

                <Property Name="buyer_guid" Type="Edm.Guid" sap:label="Node Key"/>

                <Property Name="company_name" Type="Edm.String" MaxLength="80" sap:label="Company"/>

                <NavigationProperty Name="tocustomer" Relationship="Z_OVP_DEMO1_CDS.assoc_0CFA20832D9A6542392C03D99CAB657E" FromRole="FromRole_assoc_0CFA20832D9A6542392C03D99CAB657E" ToRole="ToRole_assoc_0CFA20832D9A6542392C03D99CAB657E"/>

                <NavigationProperty Name="toitems" Relationship="Z_OVP_DEMO1_CDS.assoc_676F199F5B5CA567005EB30EEDE7C6C0" FromRole="FromRole_assoc_676F199F5B5CA567005EB30EEDE7C6C0" ToRole="ToRole_assoc_676F199F5B5CA567005EB30EEDE7C6C0"/>

            </EntityType>

my annotation file includes :

      <Schema

            xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="z_ovp_demo1_cds_van.v1">

            <Annotations Target="sap.com.cds_z_ovp_demo1.Z_Ovp_Demo1Type">

                <Annotation Term="UI.LineItem" Qualifier="ordOverView">

                    <Collection>

                        <Record Type="UI.DataField">

                            <PropertyValue Property="Label" String="Sales Order"/>

                            <PropertyValue Property="Value" Path="sales_order_id"/>

                        </Record>

                        <Record Type="UI.DataField">-->

                            <PropertyValue Property="Label" String="Net Amount"/>

                            <PropertyValue Property="Value" Path="net_amount"/>

                        </Record>

                        <Record Type="UI.DataField">

                            <PropertyValue Property="Label" String="Customer"/>

                            <PropertyValue Property="Value" Path="company_name"/>

                        </Record>

                    </Collection>

                </Annotation>

                <Annotation Term="UI.SelectionFields">

                    <Collection>

                        <PropertyPath>sales_order_id</PropertyPath>

                        <PropertyPath>company_name</PropertyPath>

                    </Collection>

                </Annotation>

            </Annotations>

        </Schema>

Could someone help to figure out where is the error/bugs ?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Guillaume2
Participant
0 Kudos

Hello again,

I have worked on the issue, and here is my findings:

I have created a local annotation file where I put the currency_code field and do a concatenation for net_amount. here is the extract from the annotation file :

<edmx:DataServices>

    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Alias="Z_OVP_DEMO1_CDSAnnotation"

      Namespace="sap.cbesh.cestbon.Z_OVP_DEMO1_CDSAnnotation">

      <Annotations Target="Z_OVP_DEMO1_CDS.Z_Ovp_Demo1Type">

        <Annotation Term="UI.LineItem" Qualifier="Test2">

          <Collection>

            <Record Type="UI.DataField">

              <PropertyValue Property="Label" String="Sales Order"/>

              <PropertyValue Property="Value" Path="sales_order_id"/>

            </Record>

            <Record Type="UI.DataField">

              <PropertyValue Property="Label" String="Net Amount"/>

              <PropertyValue Property="Value">

                <Apply Function="odata.concat">

                  <Path>net_amount</Path>

                  <String>...</String>

                  <Path>currency_code</Path>

                </Apply>

              </PropertyValue>

            </Record>

            <Record Type="UI.DataField">

               <PropertyValue Property="Value" Path="currency_code"/>

               <PropertyValue Property="Label" String="Currency"/>

            </Record>

          </Collection>

        </Annotation>

      </Annotations>

    </Schema>

  </edmx:DataServices>


I still get the remote annotation file unchanged : Z_OVP_DEMO1_CDS_VAN.xml


<edmx:DataServices>

    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="z_ovp_demo1_cds_van.v1">

      <Annotations Target="Z_OVP_DEMO1_CDS.Z_Ovp_Demo1Type">

        <Annotation Term="UI.LineItem">

          <Collection/>

        </Annotation>

        <Annotation Term="UI.LineItem" Qualifier="ordOverView">

          <Collection>

            <Record Type="UI.DataField">

              <PropertyValue Property="Label" String="Sales Order"/>

              <PropertyValue Property="Value" Path="sales_order_id"/>

            </Record>

            <Record Type="UI.DataField">

              <PropertyValue Property="Label" String="Customer"/>

              <PropertyValue Property="Value" Path="company_name"/>

            </Record>

            <Record Type="UI.DataField">

              <PropertyValue Property="Label" String="Net Amount"/>

              <PropertyValue Property="Value" Path="net_amount"/>

            </Record>

          </Collection>

        </Annotation>

      </Annotations>

    </Schema>

  </edmx:DataServices>

then I have created a new Table Card, here is the manifest.json extract :

"dataSources": {

      "Z_OVP_DEMO1_CDS": {

        "uri": "/sap/opu/odata/sap/Z_OVP_DEMO1_CDS/",

        "type": "OData",

        "settings": {

          "annotations": [

            "Z_OVP_DEMO1_CDS_VAN",

            "annotation1"

          ],

          "localUri": "localService/Z_OVP_DEMO1_CDS/metadata.xml"

        }

      },

      "Z_OVP_DEMO1_CDS_VAN": {

        "uri": "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='Z_OVP_DEMO1_CDS_VAN',Version='0001')/$value/",

        "type": "ODataAnnotation",

        "settings": {

          "localUri": "localService/Z_OVP_DEMO1_CDS/Z_OVP_DEMO1_CDS_VAN.xml"

        }

      },

      "annotation1": {

        "uri": "localService/Z_OVP_DEMO1_CDS/annotation1.xml",

        "type": "ODataAnnotation",

        "settings": {

          "localUri": "localService/Z_OVP_DEMO1_CDS/annotation1.xml"

        }

....

"OVP_Demo2_card00": {

        "model": "Z_OVP_DEMO1_CDS",

        "template": "sap.ovp.cards.table",

        "settings": {

          "title": "{{OVP_Demo2_card00_title}}",

          "subTitle": "{{OVP_Demo2_card00_subTitle}}",

          "entitySet": "Z_Ovp_Demo1",

          "addODataSelect": "false",

          "annotationPath": "com.sap.vocabularies.UI.v1.LineItem#ordOverView"

        }

      },

"OVP_Demo2_card01": {

        "model": "Z_OVP_DEMO1_CDS",

        "template": "sap.ovp.cards.table",

        "settings": {

          "title": "{{OVP_Demo2_card01_title}}",

          "subTitle": "{{OVP_Demo2_card01_subTitle}}",

          "entitySet": "Z_Ovp_Demo1",

          "addODataSelect": "false",

          "annotationPath": "com.sap.vocabularies.UI.v1.LineItem#Test2"

        }

When I run the App I get this (even after doing all cache cleanup):

The numbers appears, but still an issue with the amount. In fact the net amount for order 50000000 should be 21,737.00 € and not 21.737K€.


I think this has something to do with language local setting, as my os is French => I need to investigate on this.

nothing else have changed on the project... I still don't have any idea from where the issue comes...

If someone could help ?

Thanks.

Best Regards.



Guillaume2
Participant
0 Kudos

Hello,

small things on the language : I have tried to execute the App on a full english desktop, but still have the same issue.

My SAP system is only installed with DE and EN.

still no clue.