Skip to Content
0
Former Member
Jul 22, 2016 at 12:04 PM

SAPUI5 Runtime Adaption with SmartForms in ObjectPages

445 Views

Hi Community,

currently i am developing a SAPUI5 app in which i want to use SAP Runtime Adaption. So far it works fine if the app consists either of an ObjectPage or an SmartForm but not if the app consists of both controls.

Case one: If the app contains only a SmartForm i can adapt the fields of the SmartForm: change the label, add and delete fields … everything as expected.

Case two: Same thing if the app only contains an ObjectPage: I can change the order of the subsections of the ObjectPage, the labels, add and delete new subsections. So far so good.

Case three: I have an app consisting of an ObjectPage, the subsection of the ObjectPages each contains a SmartForm. After starting my app in the Fiori Launchpad, i click on the adapt ui button as i do in case one and two described above. The behaviour i would expected is that i can adapt my ObjectPage aswell as my SmartForm but the problem is i can only adapt the ObjectPage.

So here is my question:

Is it possible to have an app with an ObjectPage containing of SmartForms in the subsections and adapt both during runtime?

If it is possible there must be something wrong with my code so in this case i share it with you.

The structure of my app is as follows:

Index.html -> Shell -> ComponentContainer -> Component -> App.view.xml (RootView) -> MasterObjectPage.view.xml -> OpSubBlockWann.view.xml

And here comes the code:

Index.html:

<script id="init-shell">
     sap.ui.getCore().attachInit(function() {
          sap.ui.require([
               "sap/m/Shell",
               "sap/ui/core/ComponentContainer",
               "gkv/uiap02/UFB/Component"
          ], function (Shell, ComponentContainer, Component) {
                                                                        
     new sap.m.Shell({
          id : "mainShellId",
                    app: new sap.ui.core.ComponentContainer({
                         height : "100%",
                         id : "mainAppId",
                         component : new Component({
                              id: "mainComponentId"
                         })
                    })
               }).placeAt("content");
          });
     });
</script>


App.view.xml:

<content id="appViewPageContentId">
               <mvc:XMLView id="gpHeaderPanelViewId1" viewName="gkv.uiap02.UFB.view.GpHeaderPanel"/>
               <mvc:XMLView id="masterObjectPageViewId1" viewName="gkv.uiap02.UFB.view.MasterObjectPage"/>
</content>


MasterObjectPage.view.xml

<ObjectPageLayout id="masterObjectPageLayoutId" enableLazyLoading="false">
     <sections id="masterObjectPageLayoutSectionsId1">
                                          
          <ObjectPageSection id="masterObjectPageSectionWannId" title="{i18n>masterObjectPageSectionTitleWann}">
               <subSections id="masterObjectPageSubSectionsId1">
                    <ObjectPageSubSection id="masterObjectPageSubSectionWannId">
                         <blocks id="masterObjectPageBlocksId1">
                              <block id="masterObjectPageBlockWannId" xmlns="gkv.uiap02.UFB.block.OpSubBlockWann"/>
                         </blocks>
                    </ObjectPageSubSection>
               </subSections>
          </ObjectPageSection>


OpSubBlockWann.view.xml

<mvc:View controllerName="gkv.uiap02.UFB.controller.OpSubBlockWann"
             xmlns:mvc="sap.ui.core.mvc"
             xmlns:core="sap.ui.core"
             xmlns="sap.m"
             xmlns:html="http://www.w3.org/1999/xhtml"
             xmlns:smartForm="sap.ui.comp.smartform"
             xmlns:smartField="sap.ui.comp.smartfield"
             xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
             class="sapUiSizeCompact"
             height="100%"
             id="OpSubBlockWannViewId">

  <smartForm:SmartForm id="OpSubBlockWannSmartFormId"
            app:defaultCheckBoxDisplayBehaviour="OnOff"
            app:defaultDropDownDisplayBehaviour="idAndDescription"
            editTogglable="true" title="{i18n>opSubBlockWannLabel1}"
            flexEnabled="true"
           editable="true">

     <smartForm:Group id="OpSubBlockWannGroup1Id">

          <smartForm:GroupElement id="OpSubBlockWannGroupElement1Id">
                <smartField:SmartField value="{Unfalltag}" id="OpSubBlockWannSmartFiel1Id"/>
          </smartForm:GroupElement>

          <smartForm:GroupElement id="OpSubBlockWannGroupElement2Id">
               <smartField:SmartField value="{Unfalluhrzeit}" id="OpSubBlockWannSmartFiel2Id"/>
          </smartForm:GroupElement>

          <smartForm:GroupElement id="OpSubBlockWannGroupElement3Id">
               <smartField:SmartField value="{OrtUnfall}" id="OpSubBlockWannSmartFiel3Id"/>
          </smartForm:GroupElement>

          <smartForm:GroupElement  id="OpSubBlockWannGroupElement4Id">
               <smartField:SmartField value="{Folgeunfall}" id="OpSubBlockWannSmartFiel4Id"/>
          </smartForm:GroupElement>



Thanks in advance for the help and best regards

Simon