cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind data into smart table tree table

Former Member
  1. Currenty i'm using a Odata service to bind data to a tree table. I need to create a smart table (with type of tree table) using same Odata Service. Need to support smart filter as well. Can some one explain? thank you very much

this is my xml view

smartFilterBar:SmartFilterBar id="smartFilterBar" 
entityType="WipTemplatesType">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration key="ProductType" visibleInAdvancedArea="true" preventInitialDataFetchInValueHelpDialog="false">
</smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>

<smartTable:SmartTable tableType="TreeTable" id="smartTable_ResponsiveTable" smartFilterId="smartFilterBar" editable="false"
entitySet="WipTemplates"
tableBindingPath="/WipTemplates"
useVariantManagement="false" useTablePersonalisation="true" header="Products" showRowCount="true"
useExportToExcel="false" enableAutoBinding="true">
</smartTable:SmartTable>

this is the annotation for Columns

<Annotations Target="PMTS_SERVICES.WIPTemplateOdataSvc.WipTemplatesType" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="com.sap.vocabularies.UI.v1.LineItem">
<Collection>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
        <PropertyValue Property="Value" Path="WipTemplateId"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
       <PropertyValue Property="Label" String="Order Item ID"/>
       <PropertyValue Property="Value" Path="OrderItemId"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
         <PropertyValue Property="Value" Path="PONumber"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
        <PropertyValue Property="Value" Path="CalculationMethod"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
         <PropertyValue Property="Value" Path="DepartmentId"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
        <PropertyValue Property="Value" Path="Tasks"/>
</Record>
<Record Type="com.sap.vocabularies.UI.v1.DataField">
       <PropertyValue Property="Value" Path="ProductType"/></Record>
        <Record Type="com.sap.vocabularies.UI.v1.DataField">
       <PropertyValue Property="Value" Path="Tasks"/>
     </Record>
</Collection>
</Annotation>
</Annotations>

this is the controller

var sPath = jQuery.sap.getModulePath("attune.wipWIP.localService");
var oModel = new sap.ui.model.odata.v2.ODataModel("destinations/pmts/PMTS_SERVICES/WIPTemplateOdataSvc.xsodata/", {
annotationURI: sPath + "/metadata_wip_annotation.xml",
useBatch: true
});
oModel.setDefaultBindingMode("TwoWay");
this.getView().setModel(oModel);

I'm Getting following error

"Neither navigation paths parameters, nor (complete/valid) tree hierarchy annotations where provided to the TreeBinding"

here is the output

smarttree-table.png

normal tree table (without smart table) out put as follows

treetable.png

Need to add "Task", "Planned Date", "Actual Date" Columns to smart tree table as well.

(these are the properties of children)

thank you very much

Accepted Solutions (0)

Answers (2)

Answers (2)

ThorstenHoefer
Active Contributor
0 Kudos

Hi,

I have done something like this with annotations

    DATA: lo_reference   TYPE REF TO /iwbep/if_mgw_vocan_reference.
    DATA: lo_ann_target  TYPE REF TO /iwbep/if_mgw_vocan_ann_target.
    DATA: lo_annotation  TYPE REF TO /iwbep/if_mgw_vocan_annotation.
    DATA: lo_collection  TYPE REF TO /iwbep/if_mgw_vocan_collection.
    DATA: lo_record      TYPE REF TO /iwbep/if_mgw_vocan_record.
    DATA: lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
          lo_property    TYPE REF TO /iwbep/if_mgw_odata_property.
    DATA lo_oanno TYPE REF TO /iwbep/if_mgw_odata_annotation. " OData Annotation


    lo_entity_type = model->get_entity_type( iv_entity_name = gc_entity ). "Entity name

    lo_property = lo_entity_type->get_property( iv_property_name = 'ElementId' ). "Property to be annotated
    lo_oanno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
    lo_oanno->add(  iv_key = /iwbep/if_ana_odata_types=>gcs_ana_odata_annotation_key-hierarchy_node_for  iv_value    = 'ElementId' ).

    lo_property = lo_entity_type->get_property( iv_property_name = 'NodeLevel' ). "Property to be annotated
    lo_oanno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
    lo_oanno->add(  iv_key = /iwbep/if_ana_odata_types=>gcs_ana_odata_annotation_key-hierarchy_level_for  iv_value    = 'ElementId' ).

    lo_property = lo_entity_type->get_property( iv_property_name = 'PElementId' ). "Property to be annotated
    lo_oanno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
    lo_oanno->add(  iv_key = /iwbep/if_ana_odata_types=>gcs_ana_odata_annotation_key-hierarchy_parent_node_for  iv_value    = 'ElementId' ).

    lo_property = lo_entity_type->get_property( iv_property_name = 'Drillstate' ). "Property to be annotated
    lo_oanno = lo_property->/iwbep/if_mgw_odata_annotatabl~create_annotation( /iwbep/if_mgw_med_odata_types=>gc_sap_namespace ).
    lo_oanno->add(  iv_key = /iwbep/if_ana_odata_types=>gcs_ana_odata_annotation_key-hierarchy_drill_state_for  iv_value    = 'ElementId' ).

piyush_831
Discoverer
0 Kudos

Hi Did you fine the solution ? I am facing similar issue. I have added the annotation yet I'm not getting the data in smart tree table.