Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all 6178 articles
Browse latest View live

Problem faced in using image in sapui5

$
0
0

Hi Guys,

 

I am new to ui5 sorry for noob question.I searched all post before posting here.Help me build my first complete app using ui5.

 

I have following few questions related to setting image in ui5

 

<Image src="images/logo.png">

      log.JPG

  • For the background of the login page i had set image via style now the problem is the image is fit exact its been cut or stretched how to make complete image fit exactly in the space?.Also is it possible to make the background image resolution responsive to different size window?

      

       Existing issue

       ff.JPG

       wanted like this

      ff.JPG

  • I am using a splitapp but its not having the background.how to bring the background shade.also it is possible to change it to some image background? I am using XML view

       

 

        splitapp i am using with no background shade

        Capture2.JPG

         splitapp with background shade.

         Capture.JPG

 

     

        thanks


Templates missing in SAP WebIDE

$
0
0

Hi,

 

I have two versions, one installed on my machine, we can call it as local webide and another trial account hcp (hcp.sap.com).

When I chose File >> New >> Project from Template, I do not see all the templates available. Those existing in local web ide are missing from hcp.sap.com and vice-versa.

 

Please let me know, how I can enable the templates, that is I want to see all the templates?

 

Thanks,

Suraj Pabbathi

How to set vizFrame scales not visible

$
0
0

Hello experts,

 

vizFrame is a powerful but difficult controller for new developers, I've made a demo following.

 

Only a little question:

I've set : 

oVizFrame.setVizScales(null);

in the code, But it still show scales:

Is that possible to hide all the scales in the chart?

 

Here is the code:

JS Bin - Collaborative JavaScript Debugging

 

 

 

2016-05-15 17_09_51-JS Bin - Collaborative JavaScript Debugging.png

 

 

 

 

Demo Source Code:

<!DOCTYPE html>

<html>

<head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

 

 

 

  <script src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.ui.commons,sap.ui.table,sap.viz"

  data-sap-ui-theme="sap_bluecrystal">

  </script>

 

   <script>

 

 

 

   

  

 

 

    var oModel = new sap.ui.model.json.JSONModel({

        'businessData' : [

            {

                "Country" : "",

                "Profit" : 60,

                "Forcast" : 100,

                "Target" : 300,

                "Revenue" : 200

            }

        ]

    });

 

 

    var oDataset = new sap.viz.ui5.data.FlattenedDataset({

        dimensions : [

            {

                name : 'Country',

                value : "{Country}"

            }

        ],

        measures : [

            {

                name : 'Profit',

                value : '{Profit}'

            }, {

                name : 'Target',

                value : '{Target}'

            }, {

                name : "Forcast",

                value : "{Forcast}"

            }, {

                name : "Revenue",

                value : "{Revenue}"

            }

        ],

        'data' : {

            'path' : "/businessData"

        }

    });

 

 

    var oVizFrame = new sap.viz.ui5.controls.VizFrame({

        'uiConfig' : {

            'applicationSet' : 'fiori'

        },

        'vizType' : 'bullet'

    });

      oVizFrame.setVizProperties({

        plotArea : {

          dataLabel: {

                        visible: true

                    },

          primaryScale:{fixedRange: true, maxValue: 350, minValue: 0 },

            colorPalette : null,

            gap : {

                visible : false

            }

        },

        valueAxis: {

                        title: {

                            visible: false

                        }

                    },

        categoryAxis: {

                        title: {

                            visible: false

                        }

                    },

      

        legend : {

            title : {

                visible : false

            }

        },

 

 

        title : {

            visible : false,

            text : 'Bullet (with gap enabled)'

        }

    });

oVizFrame.setDataset(oDataset);

    oVizFrame.setModel(oModel);

     oVizFrame.setVizScales(null);

   

    var feedPrimaryValues = new sap.viz.ui5.controls.common.feeds.FeedItem({

        'uid' : "primaryValues",

        'type' : "Measure",

        'values' : [

            "Profit"

        ]

    }), feedAxisLabels = new sap.viz.ui5.controls.common.feeds.FeedItem({

        'uid' : "axisLabels",

        'type' : "Dimension",

        'values' : [

            "Country"

        ]

    }), feedTargetValues = new sap.viz.ui5.controls.common.feeds.FeedItem({

        'uid' : "targetValues",

        'type' : "Measure",

        'values' : [

            "Target"

        ]

    }), feedForecastValues = new sap.viz.ui5.controls.common.feeds.FeedItem({

        'uid' : "forecastValues",

        'type' : "Measure",

        'values' : ["Forcast"]

    }), feedAdditionalValues = new sap.viz.ui5.controls.common.feeds.FeedItem({

        'uid' : "additionalValues",

        'type' : "Measure",

        'values' : ["Revenue"]

    });

 

 

    oVizFrame.addFeed(feedPrimaryValues);

    oVizFrame.addFeed(feedAxisLabels);

   

    oVizFrame.addFeed(feedAdditionalValues);

   

    oVizFrame.addFeed(feedForecastValues);

    oVizFrame.addFeed(feedTargetValues);

 

 

 

   

        oVizFrame.placeAt("content");

   

      </script>

  

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

Create Operation using ODataModel.create

$
0
0

Hi,

 

In my SAPUI5 application i am trying to create a record in backend SAP system via NW Gateway system. For this my client is using SMP3.0 SP05 as a middle-ware server through Relay server configured. First i tried using REST Client, & i am able to create it successfully after getting the X-CSRF-Token. But when i am using ODataModel.create method to create the entry, i am getting forbidden error(403). Please check my below code:-

 

onPressSubmit:function(){    var newUrl = "";    newUrl = sap.app.config.smpUrl +    sap.app.config.CreateActivity;    jQuery.sap.require("sap.ui.model.odata.ODataModel");    $(function(){    mHeaders = {    "X-Requested-With" : "XMLHttpRequest",                       "Content-Type" : "application/atom+xml",                       "DataServiceVersion" : "2.0",                       "X-CSRF-Token" : "Fetch",                       "X-SMP-APPCID": appCID,                       "Access-Control-Allow-Origin": "*",    "Access-Control-Allow-Methods": "GET,PUT,POST,DELETE,OPTIONS",    "Access-Control-Allow-Headers": "Origin, Content-Type, Authorization, Accept, X-Request-With",    "Access-Control-Allow-Credentials": "true"    };    this.createActivityModel = new sap.ui.model.odata.ODataModel(newUrl, false, "username", "password",mHeaders);    this.createActivityModel.attachRequestFailed(function(evt) {                  alert("Server error: " + evt.getParameter("message") + " - " + evt.getParameter("statusText"));    });    this.createActivityModel.setHeaders(                                      {                                  "X-Requested-With": "XMLHttpRequest",      "Content-Type": "application/atom+xml",      "DataServiceVersion": "2.0",            "X-CSRF-Token":"Fetch",     "X-SMP-APPCID": appCID,    "Access-Control-Allow-Origin": "http://localhost",    "Access-Control-Allow-Methods": "GET,PUT,POST,DELETE",    "Access-Control-Allow-Headers": "Content-Type"                       });    jQuery.sap.log.debug(this.createActivityModel);              oCore = sap.ui.getCore().setModel(this.createActivityModel);    var oEntry = {};    oEntry.DeviceType = sap.app.config.deviceType;    /*this.createActivityModel.setHeaders({   "X-REQUESTED-WITH": "XMLHttpRequest",      });*/               var oEntry={          "IvDescription":"Test by UI Team",          "IvStartDt":"2016-03-07T00:00:00",          "IvEndDt":"2016-03-07T00:00:00",          "IvStartTime":"100000",          "IvEndTime":"",          "IvStatus":"E0001",          "IvCategory":"IvActivityType",          "Text":"Test team UI",                               address:[            { "PartnerName":"",            "PartnerFct":"00000009",            "PartnerId":"7000011183"            },            {            "PartnerName":"",            "PartnerFct":"ZSEESP1",            "PartnerId":"EM00700112"            },          ],                      };                       //this.createActivityModel.create("/AppointmentCreateStdSet",oEntry,{success: this.mySuccessHandler, error: this.myErrorHandler});        this.createActivityModel.create("/AppointmentCreateStdSet",oEntry,null, function doSaveLunchData_OnSuccess(oData, response) {               alert("  doSaveLunchData_OnSuccess()");               logSaveData = oData.results;             },             function doSaveLunchData_OnError(oError) {               alert("  doSaveLunchData_OnError()");                       alert("error: "+oError);             }           );    });    var router = sap.ui.core.UIComponent.getRouterFor(this);    router.navTo("newActivity", null, false);//navigation to the newActivity page using router    },  

Please check the response i got below:-

Response2.jpgResponse1.jpg

Please suggest.

 

Thanks,

Shrikant.

HarveyBallMicroChart : How to show the other pieces

$
0
0

Hello experts,

 

I've tried to use  HarveyBallMicroChart, I think it's designed to show little pie chart, and it's make sense that there're several pieces of pie in the chart.

But it seems it can only show one piece in the pie chart, like this:

2.png

even I've add the second piece:

 

3.png

 

Here is the source code:

 

JS Bin - Collaborative JavaScript Debugging

 

 

 

 

Demo Source Code:

<!DOCTYPE html>

<html>

<head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

 

 

 

  <script src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.ui.commons,sap.suite.ui.commons,sap.viz"

  data-sap-ui-theme="sap_bluecrystal">

  </script>

 

   <script>

  

 

 

     var complateChart = new sap.suite.ui.commons.HarveyBallMicroChart({

  size:"M",

  total:500,

  totalScale:"Min",

  showTotal:true,

  showFractions:true,

  items:[

                   new sap.suite.ui.commons.HarveyBallMicroChartItem({fraction:100, color:"Good", fractionScale:"Min" }),

  new sap.suite.ui.commons.HarveyBallMicroChartItem({fraction:20, color:"Error", fractionScale:"Min" })

  ]

  });

  

    

        complateChart.placeAt("content");

    

      </script>

   

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

Adding smart fields and smart group elements in a SMART FORM in SAP UI5

$
0
0

Dear All,

 

I am facing an issue with smart for.

 

Following are my requirement:

 

  • Need to add a smart form inside a dialog box.
  • The smart form should have properties like smartform group,smartfield,group elements.

 

But I am getting an error(PFA the error screenshot).

 

The application runs fine (smartform gets rendered)if I remove the smartfield and the group elements.

Once the smartField or the Group Elements are added, the app shows the error.

 

The error is"Uncaught TypeError: G.setHorizontalLayoutGroupElementMinWidth is not a function" .

 

 

PFA the screenshot of my XMl code too.

 

Please give some valuable suggestions on this.

 

Best Regards,

Sushant Nath

Can we edit VizFrame labels?

$
0
0

Hi experts.

 

I have a VizFrame and want to change values of y-axis. To do that, I have to a)somehow gain access to labels and make them editable for user, b)read user-input, c) write new values into VizFrame JSON Model and d)renew VizFrame Control. Everything seems clear to me, except a)

 

My VizFrame is here - JS Bin - Collaborative JavaScript Debugging

 

I need to edit QUANTITY labels.

 

Is it possible in UI5, or it's better to create table with the same JSON Model, as VizFrame has, make it look like VizFrame's labels (CSS) and do input there?

 

Thanks.

How to call another function on Omodel create success

$
0
0

Is it possible to call another function on success of OModel create success? I am trying like below code in a view1.controller.js

 

oModel.create('/EntitySet', requestBody, {  success: function(oData, oResponse) {  sap.m.MessageToast.show("Success");
this.mynewfunction();
},  error: function(oError) {  sap.m.MessageToast.show(" error");  }
mynewfunction: function() {
alert("function triggered")
}

The success toast appears , but facing this.mynewfunction is not a function error.


How to access component properties in createContent

$
0
0

Hi All,

I have a reusable component which can be instantiated in other applications using

 

sap.ui.getCore().createComponent({  name: "sample.service",  id : "a12345",  settings:{   key: "A9320"  }

 

In my component.js, I want to be able to access the value of the property key inside createContent to change the view being loaded according to the value of the key.

var Component = UIComponent.extend("sample.service.Component", {  metadata : {  "manifest" : "json",  "library" : "sample.service",  properties : {  key : {type: 'string', group:  'Misc', defaultValue:null},  }  },  onBeforeRendering:function()  {     console.log(this.getKey());
//    this.page = new sap.ui.view({ viewName:"sample.service.view.View2", type:sap.ui.core.mvc.ViewType.XML});       },  init : function()  {        UIComponent.prototype.init.apply(this, arguments);        var a;  },  createContent: function(){            console.log(this.getKey());                 if(this.getKey() === "a123")     {            this.page = new sap.ui.view({ viewName:"sample.service.view.View1", type:sap.ui.core.mvc.ViewType.XML});     }     else     {       this.page = new sap.ui.view({ viewName:"sample.service.view.View2", type:sap.ui.core.mvc.ViewType.XML});     }  return this.page;    },
});

 

Although the getters and setters are defined automatically for the property, if I call this.getKey() inside createContent, it returns an empty string.

I can access the key value inside the controller of the view after the view is instantiated but not in init() or createContent().

this.getKey() returns the value in onBeforeRendering() also. Is it possible to change the view being loaded at this point?

The development toolkit mentions that a JSON object componentData can be accessed inside createContent.How do I access this object? Where are the parameters defined?

SAPUI5 SDK - Demo Kit

 

 

Thanks and Regards,

VIjay

Create and consume service with input table

$
0
0

Hi experts

 

I need to create a service with as input a table...

Actually i've created only services with field as input..now i've a table type.

 

How can i do that?any samples?

Build the companion app error SAP HAT

$
0
0

Hi All,

I followed the steps in blog How to install Hybrid Application Toolkit (HAT) on Windows (part 3 of 3) .I am facing some error during Build the companion app.Even i tried running it manually in same way as u mentioned in one comment but got error.I am attaching the files.I am using latest SAP HAT version.For any information regarding this please reply me .

Kindly help me how to proceed.




 

Thanking You

WF ECC to FIORI

$
0
0

Hi!

 

I need help; how to send a WF approval step in the ECC for fiori? how to get back the decision of fiori to the ECC?

Tile container in List Item in SAPUI5

$
0
0

Hi Guys,

 

I have to add a tile container in list item of list.

 

I have tried in CustomListItem, but it's not working. so, is there any way to achieve this task.

 

XML View:

 

<Page title="Title">

    

  <!-- Head Section Starts -->

      <customHeader>

         <Toolbar class="pageHeader">

  <Label text="Header" />

  </Toolbar>

  </customHeader>

  <!-- Head Section Ends -->

 

  <!-- SubHead Section Starts -->

      <subHeader>

         <Toolbar class="pageSubHeader">

  <SearchField />

  </Toolbar>

  </subHeader>

  <!-- SubHead Section Ends -->

 

  <!-- List Container Section Starts -->

  <List headerText="Operation" mode="Navigation" items="" >

    <CustomListItem>

       

        <!-- List Item Starts -->

    <Label text="Operation" />

  

    <!-- Tile Container Section Starts -->

  <TileContainer

  id=""

  tiles="">

    

     <!-- Tile Section Starts -->

      <CustomTile>

         <Label text="Tile 1" />

      </CustomTile>

     <!-- Tile Section Ends -->

    

     <!-- Tile Section Starts -->

      <CustomTile>

         <Label text="Tile 2" />

      </CustomTile>

     <!-- Tile Section Ends -->

    

     <!-- Tile Section Starts -->

      <CustomTile>

         <Label text="Tile 3" />

      </CustomTile>

     <!-- Tile Section Ends -->

    

     <!-- Tile Section Starts -->

      <CustomTile>

         <Label text="Tile 4" />

      </CustomTile>

     <!-- Tile Section Ends -->

    

      </TileContainer>

  <!-- Tile Container Section Ends -->

 

  <!-- List Item Ends -->

 

    </CustomListItem>

  </List>

  <!-- List Container Section Ends -->

 

  </Page>

 

Regards,

Dhiraj.

Error while calling a OData Gateway Service in SAPUI5

$
0
0

Hello Experts,

 

We are working on consuming a OData Gateway service in SAPUI5 and have roadblocks while achieving it.

 

Firstly, we created a service in SEGW in the Gateway system, and mapped it to a custom RFC. We generated the classes, but we are facing an issue with registering the service. When we click on 'Register' under 'Service Maintenance', the 'Registration Status' is not updated to green. Moreover, when we try to 'Maintain' the service, we get a message, 'Service not registered in the system'. We have followed the (Quick Starter Configuration Guide - SAP Gateway) and everything seems to be in place. However, we are unable to register the service or figure what is missing here. Request your expertise on this.

 

Hereafter, we tried calling this service from UI5. We used the following code for calling the service:

 

var oModel = new sap.ui.model.odata.ODataModel("<domain_name>:<port_no>/sap/opu/odata/sap/ZTEST_EMAIL_SRV", false, "<UID>", "<PWD>");

Please note, here the actual values are replaced by placeholders (angular brackets).

 

However, we are getting an error: 404: Method Not Found error or 401: (Unauthorized) error. We went through the configuration several times and even tried consuming a standard service, but we still get the same error. Are we missing any configuration here? Or could it be since we are unable to register the service???

 

Request your expert advise to get a resolution to this.

Thanks in advance!!!

 

Regards,

Divyata Dal

How to use VizFrame charts in android phones?

$
0
0

Hi,

 

I have developed an sap ui5 application, which includes vizframe charts. Now I created an apk of my application, but when I tried running it on my phone it didn't recognize vizframe library. So my question is,can we use vizframe charts in android phones?


Error while creating batch operation

$
0
0

Hi experts,

 

I am getting an error in my fiori application as

 

Uncaught TypeError: oModel.createBatchOperation is not a function,

 

Can you suggest a solution for this

 

Thanks,

Shahid

Error 500 when starting web IDE

$
0
0

Since a few days I get following error when I try to open SAP webide

HTTP Status 500 - An internal application error occurred. Request: 728029758 s0004882249trial:webide

In the past it worked fine....

How could this error be solved?

Uncaught TypeError: Cannot read property 'ui5' of undefined

$
0
0

Hi,

 

I'm trying to read the JSON data returned from HTTP GET of a url and using this data to populate my Line chart. But its throwing error 'Uncaught TypeError: Cannot read property 'ui5' of undefined' in the line containing 'new sap.viz.ui5.data.FlattenedDataset'. I dont know whats the mistake.

 

My code:

 

var oModel = new sap.ui.model.json.JSONModel();

  oModel.loadData(url);

  sap.ui.getCore().setModel(oModel);

 

  var dataset = new sap.viz.ui5.data.FlattenedDataset({

        dimensions : [

         {

           axis : 1,

           name : 'Timestamp',

           value : "{timestamp}"

         }

        ],

 

        measures : [

                    {

                    group : 1,

                        name : 'Power  (in KW.h)',

                        value : '{power}'

                    },

                    {

                    group: 2,

                        name : 'No of Plugs',

                        value : '{numberOfPlugs}'

                    }

        ],

     

        data : {

          path : "/_embedded/overallPowers"

        }

 

      });

 

 

    var line = new sap.viz.ui5.DualLine({

            id : "dualline",

            width : "100%",

            height : "400px",

            title : {

              visible : true,

              text : 'Power Utilisation'

            },

            xAxis : {

              title : {

                visible : true

              }

            },

            yAxis : {

              title : {

                visible : true

              }

            },

            dataset : dataset

          });

 

 

  line.setModel(oModel);

  line.placeAt("content");

 

</script>

</head>

<body id="content" class="sapUiBody">

</body>

</html>

 

 

 

input JSON data which is returned from url:

 

{

  "_embedded" : {

  "overallPowers" : [ {

  "timestamp" : 456,

  "power" : 5.0,

  "numberOfPlugs" : 555,

  "_links" : {

  "self" : {

  "href" : "http://localhost:8096/overallPowers/456"

  },

  "overallPower" : {

  "href" : "http://localhost:8096/overallPowers/456"

  }

  }

  }, {

  "timestamp" : 678,

  "power" : 8.0,

  "numberOfPlugs" : 98,

  "_links" : {

  "self" : {

  "href" : "http://localhost:8096/overallPowers/678"

  },

  "overallPower" : {

  "href" : "http://localhost:8096/overallPowers/678"

  }

  }

  }, {

  "timestamp" : 123,

  "power" : 5.768,

  "numberOfPlugs" : 6,

  "_links" : {

  "self" : {

  "href" : "http://localhost:8096/overallPowers/123"

  },

  "overallPower" : {

  "href" : "http://localhost:8096/overallPowers/123"

  }

  }

  } ]

  },

  "_links" : {

  "self" : {

  "href" : "http://localhost:8096/overallPowers"

  },

  "profile" : {

  "href" : "http://localhost:8096/profile/overallPowers"

  },

  "search" : {

  "href" : "http://localhost:8096/overallPowers/search"

  }

  }

}

How to place logo or icon at the Center of Unified Shell header?

$
0
0

Hi,

 

My requirement is,

 

I want to add a logo/icon in Center of Unified shell Header.

 

i try it in headItems but it is coming at left side only, but i want at center.

 

Thanks,

Rohit.

how to connect to oracle db from UI5 project

$
0
0

Hi ,

 

our back end is oracle database , usually we use jdbc connectors and connect to oracle db and fetch data and process etc , in UI5 application can anyone explain how to connect to oracle database .

our ui5 appilcation developed has a view which is based on  java script controller .

 

Regards

Govardan Raj S

Viewing all 6178 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>