Skip to Content
author's profile photo Former Member
Former Member

SAPUI5 Runtime Adaption with SmartForms in ObjectPages

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 22, 2016 at 08:33 PM

    Hi Simon,

    it is possible to adapt applications containing SmartForms inside of ObjectPages using UI Adaptation at Runtime. The only part, which is not yet supported for UI adaptation in your case is a "block" control (sap.uxap.BlockBase). So, if you could try another layout instead, it should work.

    I suggest you to try something like following:

    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">
    
                                  <layout:GridLayout>
                                       <smartForm:SmartForm id="OpSubBlockWannSmartFormId"  ... >
                                            ...
                                       </smartForm:SmartForm>
                                  </layout:GridLayout>
    
    </blocks> </ObjectPageSubSection> </subSections> </ObjectPageSection>

    hope this helps

    Best Regards,

    Mikhail

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.