Skip to Content
May 18, 2018 at 04:31 PM

smartform in sapui5 binding issues



I am trying to create a smartform attached to a odata service with cds view. I am able to create smartfilter and table successfully using annotations and metadata.xml but am stuck up in smartform. The view renders fine with smartfields but the catch is that I have to define entitySet for each of the smartfield whereas in sample applications I checked this was not required.If I remove the entity set from smartfield the smartfield is not rendered. Here is the sequence of steps I followed

Step1: I imported odata service and created a default model.

Step2: Created local annotations file based on data service and it looks as below:

<Annotations Target="ZCustomService.ZCustomServiceType"> <Annotation Term="Common.SemanticKey"> <Collection> <PropertyPath>abc</PropertyPath> </Collection> </Annotation> </Annotations>

In metadata same property exists as below:

<Property Name="abc" Type="Edm.String" MaxLength="4" sap:display-format="UpperCase" sap:creatable="true" sap:updatable="true" sap:label="Purchase Order"/>

In my view, I am using smartform as below:

<sap.ui.comp.smartform:SmartForm xmlns:sap.ui.comp.smartform="sap.ui.comp.smartform" xmlns:sap.ui.comp.smartfield="sap.ui.comp.smartfield" id="__form1"> <sap.ui.comp.smartform:groups> <sap.ui.comp.smartform:Group label="Group title" title="Group title" id="__group0"> <sap.ui.comp.smartform:groupElements> <sap.ui.comp.smartform:GroupElement id="__element0"> <sap.ui.comp.smartform:elements> <sap.ui.comp.smartfield:SmartField id="__field0" value="{abc}" entitySet ="ZCustomService"/> </sap.ui.comp.smartform:elements> </sap.ui.comp.smartform:GroupElement> </sap.ui.comp.smartform:groupElements> </sap.ui.comp.smartform:Group> </sap.ui.comp.smartform:groups> </sap.ui.comp.smartform:SmartForm>

Request your expert advice here..

I have also gone through blogs published on SCN but I dont see these options