Manifest.json添加odata模型属性

2020-09-22 21:07发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我正在使用manifest.json应用程序,如下所示,我想添加

OdataModel属性,例如标头/user/pass。 我应该放在哪里?

https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#setHeaders

 {
 " _version":" 1.5.0",
 " sap.app":{
 " id":" $ {project.artifactId}",
 " type":"应用程序",
 " i18n":" i18n/i18n.properties",
 " applicationVersion":{
 " version":" $ {project.version}"
 },
 " title":" {{appTitle}}",
 " description":" {{appDescription}}",
 "标签":{
 "关键字":[]
 },
 " ach":" dsf",
 " resources":" resources.json",
 "数据源": {
 " mainService":{
 " uri":"/img/Ne/Customers/",
 " type":" OData",
 "设置":{
 " localUri":" localService/metadata.xml"
 }
 }
 },
 "离线":false,
 " sourceTemplate":{
 " id":" ui5template.smartTemplate",
 "版本":" 1.40.12"
 }
 },
 " sap.ui":{
 " technology":" UI5",
 "图标":{
 " icon":"",
 " favIcon":"",
 "电话": "",
 " phone @ 2":"",
 " tablet":"",
 " tablet @ 2":""
 },
 " deviceTypes":{
 "桌面":是的,
 "平板电脑":是的,
 "电话":正确
 },
 " supportedThemes":[
 " sap_hcb",
 " sap_belize"
 ]
 },
 " sap.ui5":{
 "资源":{
 " js":[],
 " css":[]
 },
 "依赖关系":{
 " minUI5Version":" $ {sap.ui5.dist.version}",
 " libs":{
 " sap.ui.core":{},
 " sap.m":{},
 " sap.ui.comp":{},
 " sap.uxap":{},
 " sap.suite.ui.generic.template":{},
 " sap.ui.layout":{},
 " sap.ushell":{},
 " sap.collaboration":{}
 },
 "组件": {}
 },
 "楷模": {
 " i18n":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ListReport | ShoppingListHeaders":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ListReport/ShoppingListHeaders/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ObjectPage | ShoppingListHeaders":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ObjectPage/ShoppingListHeaders/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ObjectPage | ShoppingListItems":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ObjectPage/ShoppingListItems/i18n.properties"
 },
 "":{
 " dataSource":" mainService",
 "设置":{
 " defaultBindingMode":" TwoWay",
 " defaultCountMode":"内联",
 " refreshAfterChange":false
 }
 }
 },
 "扩展":{
 "扩展名":{}
 },
 " contentDensities":{
 "紧凑":是的,
 "舒适":是
 }
 },
 " sap.ui.generic.app":{
 "页面":[
 {
 " entitySet":" ShoppingListHeaders",
 "零件": {
 " name":" sap.suite.ui.generic.template.ListReport",
 "列表":true
 },
 "页面":[
 {
 " entitySet":" ShoppingListHeaders",
 "零件": {
 "名称":" sap.suite.ui.generic.template.ObjectPage"
 },
 "页面":[
 {
 " navigationProperty":" to_ShoppingListItems",
 " entitySet":" ShoppingListItems",
 "零件": {
 "名称":" sap.suite.ui.generic.template.ObjectPage"
 }
 }
 ]
 }
 ]
 }
 ]
 },
 " sap.fiori":{
 " registrationIds":[],
 " archeType":"交易"
 },
 " sap.platform.hcp":{
 " uri":""
 }
 } 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


嗨,

我正在使用manifest.json应用程序,如下所示,我想添加

OdataModel属性,例如标头/user/pass。 我应该放在哪里?

https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#setHeaders

 {
 " _version":" 1.5.0",
 " sap.app":{
 " id":" $ {project.artifactId}",
 " type":"应用程序",
 " i18n":" i18n/i18n.properties",
 " applicationVersion":{
 " version":" $ {project.version}"
 },
 " title":" {{appTitle}}",
 " description":" {{appDescription}}",
 "标签":{
 "关键字":[]
 },
 " ach":" dsf",
 " resources":" resources.json",
 "数据源": {
 " mainService":{
 " uri":"/img/Ne/Customers/",
 " type":" OData",
 "设置":{
 " localUri":" localService/metadata.xml"
 }
 }
 },
 "离线":false,
 " sourceTemplate":{
 " id":" ui5template.smartTemplate",
 "版本":" 1.40.12"
 }
 },
 " sap.ui":{
 " technology":" UI5",
 "图标":{
 " icon":"",
 " favIcon":"",
 "电话": "",
 " phone @ 2":"",
 " tablet":"",
 " tablet @ 2":""
 },
 " deviceTypes":{
 "桌面":是的,
 "平板电脑":是的,
 "电话":正确
 },
 " supportedThemes":[
 " sap_hcb",
 " sap_belize"
 ]
 },
 " sap.ui5":{
 "资源":{
 " js":[],
 " css":[]
 },
 "依赖关系":{
 " minUI5Version":" $ {sap.ui5.dist.version}",
 " libs":{
 " sap.ui.core":{},
 " sap.m":{},
 " sap.ui.comp":{},
 " sap.uxap":{},
 " sap.suite.ui.generic.template":{},
 " sap.ui.layout":{},
 " sap.ushell":{},
 " sap.collaboration":{}
 },
 "组件": {}
 },
 "楷模": {
 " i18n":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ListReport | ShoppingListHeaders":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ListReport/ShoppingListHeaders/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ObjectPage | ShoppingListHeaders":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ObjectPage/ShoppingListHeaders/i18n.properties"
 },
 " i18n | sap.suite.ui.generic.template.ObjectPage | ShoppingListItems":{
 " type":" sap.ui.model.resource.ResourceModel",
 " uri":" i18n/ObjectPage/ShoppingListItems/i18n.properties"
 },
 "":{
 " dataSource":" mainService",
 "设置":{
 " defaultBindingMode":" TwoWay",
 " defaultCountMode":"内联",
 " refreshAfterChange":false
 }
 }
 },
 "扩展":{
 "扩展名":{}
 },
 " contentDensities":{
 "紧凑":是的,
 "舒适":是
 }
 },
 " sap.ui.generic.app":{
 "页面":[
 {
 " entitySet":" ShoppingListHeaders",
 "零件": {
 " name":" sap.suite.ui.generic.template.ListReport",
 "列表":true
 },
 "页面":[
 {
 " entitySet":" ShoppingListHeaders",
 "零件": {
 "名称":" sap.suite.ui.generic.template.ObjectPage"
 },
 "页面":[
 {
 " navigationProperty":" to_ShoppingListItems",
 " entitySet":" ShoppingListItems",
 "零件": {
 "名称":" sap.suite.ui.generic.template.ObjectPage"
 }
 }
 ]
 }
 ]
 }
 ]
 },
 " sap.fiori":{
 " registrationIds":[],
 " archeType":"交易"
 },
 " sap.platform.hcp":{
 " uri":""
 }
 } 
付费偷看设置
发送
4条回答
吹牛啤
1楼-- · 2020-09-22 21:47

你好

最佳实践是为此使用目的地,您可以在CP座舱中创建目的地。 (在此处提供用户名和密码)

然后在WebIDE中的项目上右键单击以添加OData服务

然后在清单的描述符编辑器中基于新的odata源添加新模型

亲切的问候

黑丝骑士
2楼-- · 2020-09-22 21:48

不过,请不要在JavaScript应用程序中放置任何用户/密码! 每个文件都下载到浏览器中,因此使用调试器可以读取它!!!!

更改您的设计;)

Climb_Ma
3楼-- · 2020-09-22 21:56

对于需要身份验证的OData,我们在清单中提供"授权"之类的标头信息以创建模型吗?

huskylover
4楼-- · 2020-09-22 21:48

嗨,

您可以在这里添加。

"":{
 " dataSource":" mainService",
 "设置":{
 " defaultBindingMode":" TwoWay",
 " defaultCountMode":"内联",
 " refreshAfterChange":false
 " headers":{" myHeader":" myHeaderValue",...}
 " user":" guru",
 " password":" trythis"
 } 

可以使用其他属性检查mParameters

https ://openui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataModel/constructor

此致

Gururaj

一周热门 更多>