Skip to Content
0

Fiori offline app works online but local store on the device is not created

Nov 08, 2017 at 04:14 AM

207

avatar image
Former Member

I have used SAP WEb IDE on Cloud platform and (project from sample application – Approve Purchase Order) using Fiori mobile cloud build service. I have successfully build and tested it online, but the offline capability doesn’t work, and I also don’t see that the initial “local store being provisioned” step. Below are my lines of code have added for your reference and kindly help

Scenario.js(created under offline folder in SAP WEB IDE)

jQuery.sap.declare(“nw.epm.refapps.purchaseorders.approve.offline.Scenario”);jQuery.sap.declare(“nw.epm.refapps.purchaseorders.approve.offline.Scenario”);nw.epm.refapps.purchaseorders.approve.offline.Scenario = {// The init function can be used to manipulate the local launchpad or for an time // based sync mechanismus (sync every 5 Minutes). init: function () {
}};

manifest.json(the below code added just above sap.ui″)

“sap.mobile”: { “sap.mobile”: { “_version”: “1.1.0”, “scenario”: “nw.epm.refapps.purchaseorders.approve.offline.Scenario”, “definingRequests”: {}, “stores”: [ { “name”: “PurchaseOrders”, “serviceRoot”: “/sap/opu/odata/sap/EPM_REF_APPS_PO_APV_SRV/”, “definingRequests”: { “PurchaseOrders”: “/PurchaseOrders”, “PurchaseOrderItems”: “/PurchaseOrderItems” } } ] }

ACF file

{{ “applications”:[ { “id”:”nw.epm.refapps.purchaseorders.approve”, “cloudComponentId”:”nwepmrefappsextpoapvsub”, “url”: “/sap/fiori/nwepmrefappsextpoapv”, “scenario”:true }], “appconfig”:{ “offline”:true } }

Kindly advice

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

avatar image
Former Member Nov 20, 2017 at 05:17 PM
0

Hi Khaja Azizuddin,

Did you found any solution for this.

Regards,

Sharique

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 23, 2017 at 04:28 AM
0

Not yet

Share
10 |10000 characters needed characters left characters exceeded
Jamie Cawley
Nov 27, 2017 at 01:55 PM
0

Looks like your manifest entry is incorrect, you should not have sap.mobile defined twice. Please see the following blog series for more info.

https://blogs.sap.com/2017/03/22/make-offline-app-using-sap-cp-mobile-service-for-sap-fiori-part-1/

Regards,

Jamie

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Jamie

Sorry for my late reply, we had public holidays here so could not check my code.

The code is fine, had a typo while creating this message. Infact I have follwed the same blog but store issue still exists. Let me if I have to check any more settings

Thanks

0
Jamie Cawley
Dec 04, 2017 at 05:00 PM
0

Are you sure you are using the correct service? I just generated the sample app and mine is using the service

/sap/opu/odata/sap/SEPMRA_PO_APV/

not

/sap/opu/odata/sap/EPM_REF_APPS_PO_APV_SRV/

Regards,

Jamie

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Jamie

I tried it with correcting the service name, the app does work for online and but the store is not getting created

Can you please provide your email id where I can attach the webide export for your reference

Thanks

0

Please just include your manifest file here.

Regards,

Jamie

0
Former Member
{
 "_version": "1.3.0",
 "sap.app": {
  "_version": "1.3.0",
  "id": "nw.epm.refapps.purchaseorders.approve",
  "type": "application",
  "i18n": "i18n/i18n.properties",
  "title": "{{shellTitle}}",
  "subTitle": "{{shellSubTitle}}",
  "tags": {
   "keywords": [
    "{{xfld.keyWord1}}",
    "{{xfld.keyWord2}}"
   ]
  },
  "applicationVersion": {
   "version": "3.0.0"
  },
  "ach": "BC-SRV-NWD-FRA",
  "dataSources": {
   "mainService": {
    "uri": "/sap/opu/odata/sap/SEPMRA_PO_APV/",
    "type": "OData",
    "settings": {
     "odataVersion": "2.0",
     "localUri": "localService/metadata.xml"
    }
   }
  },
  "resources": "resources.json",
  "crossNavigation": {
   "inbounds": {
    "productsManage": {
     "semanticObject": "EPMPurchaseOrder",
     "action": "approve",
     "title": "{{shellTitle}}",
     "subTitle": "{{shellSubTitle}}",
     "icon": "sap-icon://Fiori7/F1373",
     "indicatorDataSource": {
      "dataSource": "mainService",
      "path": "PurchaseOrders/$count",
      "refresh": 450
     },
     "signature": {
      "parameters": {
       "productID": {
        "required": false
       },
       "PurchaseOrder": {
        "required": false
       }
      },
      "additionalParameters": "allowed"
     }
    }
   }
  }
 },
 "sap.mobile": {
  "_version": "1.1.0",
  "scenario": "nw.epm.refapps.purchaseorders.approve.offline.Scenario",
  "definingRequests": {},
  "stores": [
   {
    "name": "PurchaseOrders",
    "serviceRoot": "/sap/opu/odata/sap/SEPMRA_PO_APV/",
    "definingRequests": {
     "PurchaseOrders": "/PurchaseOrders",
     "PurchaseOrderItems": "/PurchaseOrderItems"
    }
   }
  ]
 },
 "sap.ui": {
  "_version": "1.3.0",
  "technology": "UI5",
  "icons": {
   "icon": "sap-icon://Fiori7/F1373",
   "favIcon": "icon/F1373_Approve_Purchase_Orders.ico",
   "phone": "icon/launchicon/57_iPhone_Desktop_Launch.png",
   "phone@2": "icon/launchicon/114_iPhone-Retina_Web_Clip.png",
   "tablet": "icon/launchicon/72_iPad_Desktop_Launch.png",
   "tablet@2": "icon/launchicon/144_iPad_Retina_Web_Clip.png"
  },
  "deviceTypes": {
   "desktop": true,
   "tablet": true,
   "phone": true
  },
  "supportedThemes": [
   "sap_hcb",
   "sap_bluecrystal"
  ]
 },
 "sap.ui5": {
  "_version": "1.2.0",
  "dependencies": {
   "minUI5Version": "1.36.7",
   "libs": {
    "sap.m": {},
    "sap.ui.core": {},
    "sap.ui.layout": {},
    "sap.ushell": {}
   }
  },
  "models": {
   "i18n": {
    "type": "sap.ui.model.resource.ResourceModel",
    "uri": "i18n/i18n.properties"
   },
   "": {
    "dataSource": "mainService",
    "settings": {
     "defaultCountMode": "Inline"
    }
   }
  },
  "rootView": "nw.epm.refapps.purchaseorders.approve.view.Root",
  "config": {},
  "routing": {
   "config": {
    "routerClass": "sap.m.routing.Router",
    "viewType": "XML",
    "async": true,
    "viewPath": "nw.epm.refapps.purchaseorders.approve.view",
    "controlId": "approvalApp",
    "bypassed": {
     "target": [
      "master",
      "empty"
     ]
    }
   },
   "routes": [
    {
     "pattern": "",
     "name": "main",
     "target": [
      "object",
      "master"
     ]
    },
    {
     "pattern": "PurchaseOrder/{POId}",
     "name": "PurchaseOrderDetails",
     "target": [
      "master",
      "object"
     ]
    }
   ],
   "targets": {
    "master": {
     "viewName": "S2_PurchaseOrders",
     "viewLevel": 1,
     "controlAggregation": "masterPages"
    },
    "object": {
     "viewName": "S3_PurchaseOrderDetails",
     "viewLevel": 2,
     "controlAggregation": "detailPages"
    },
    "summary": {
     "viewName": "S3_PurchaseOrderSummary",
     "viewLevel": 3,
     "controlAggregation": "detailPages"
    },
    "empty": {
     "viewName": "EmptyPage",
     "viewLevel": 3,
     "controlAggregation": "detailPages"
    }
   }
  },
  "contentDensities": {
   "compact": true,
   "cozy": true
  }
 },
 "sap.platform.abap": {
  "_version": "1.2.0",
  "uri": "/sap/bc/ui5_ui5/sap/zmyofflineapp/webapp"
 },
 "sap.platform.hcp": {
  "_version": "1.1.0",
  "uri": "webapp"
 },
 "sap.fiori": {
  "_version": "1.1.0",
  "registrationIds": [
   "F1373"
  ],
  "archeType": "transactional"
 }
}
0
Former Member

Hi Jamie

Please find above the content from the manifest file

Thanks for your help

0
Jamie Cawley
Dec 06, 2017 at 09:16 PM
0

Just ran through the scenario using iOS and see the offline store being created, but receive an error due to the some of the id fields missing a maxlength, which is required for the store to be created. It would require you to fix these in the service to be able to utilize this scenario.

I do notice some other difference in your manifest...

1. The minUI5Version defined in my project is 1.44.17

2. The rootView defined in my project is nw.epm.refapps.purchaseorders.approve.view.App

So maybe you are using an older version of the sample?

Regards,

Jamie

Show 7 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Jamie

I did those changes, tried to test but it ends up with below error, I think the HCP is not working at the moment. I will try again after sometime and let you know

Thanks for the all help

{ "requestUri": "/sap/opu/odata/sap/SEPMRA_PO_APV/$metadata", "statusCode": 503, "statusText": "Service Unavailable", "headers": [], "body": "Cannot open tunnel with id account:///p19429XXXXXtrial" }

0

That would be related to your cloud connector not be connected.

Regards,

Jamie

0
Former Member
Jamie Cawley

Hi Jamie

I have created a new sample application for Approve Purchase orders with minUI5Version 1.44.17 and root view also set I have attached the screen shots of the same for your review

2. The below two errors I can see when I try to access mobile service for Development and Operation, is this step needed to enable offline capability

3. I am trying to deploy the same on android but not iOS Thanks Jamie for your help, please let me know what am I missing Regards

0
Former Member
Former Member
{
	"_version": "1.5.0",
	"sap.app": {
		"id": "nw.epm.refapps.purchaseorders.approve",
		"type": "application",
		"i18n": "i18n/i18n.properties",
		"title": "{{shellTitle}}",
		"subTitle": "{{shellSubTitle}}",
		"tags": {
			"keywords": [
				"{{xfld.keyWord1}}",
				"{{xfld.keyWord2}}"
			]
		},
		"applicationVersion": {
			"version": "3.0.0"
		},
		"ach": "BC-SRV-NWD-FRA",
		"dataSources": {
			"mainService": {
				"uri": "/sap/opu/odata/sap/SEPMRA_PO_APV/",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0",
					"localUri": "localService/metadata.xml"
				}
			}
		},
		"resources": "resources.json",
		"crossNavigation": {
			"inbounds": {
				"productsManage": {
					"semanticObject": "EPMPurchaseOrder",
					"action": "approve",
					"title": "{{shellTitle}}",
					"subTitle": "{{shellSubTitle}}",
					"icon": "sap-icon://Fiori7/F1373",
					"indicatorDataSource": {
						"dataSource": "mainService",
						"path": "PurchaseOrders/$count",
						"refresh": 450
					},
					"signature": {
						"parameters": {
							"PurchaseOrder": {
								"required": false
							}
						},
						"additionalParameters": "allowed"
					}
				}
			}
		}
	},
	"sap.mobile": {
		"_version": "1.1.0",
		"scenario": "nw.epm.refapps.purchaseorders.approve.offline.Scenario",
		"definingRequests": {},
		"stores": [
			{
				"name": "PurchaseOrders",
				"serviceRoot": "/sap/opu/odata/sap/SEPMRA_PO_APV/",
				"definingRequests": {
					"PurchaseOrders": "/PurchaseOrders",
					"PurchaseOrderItems": "/PurchaseOrderItems"
				}
			}
		]
	},
	"sap.ui": {
		"technology": "UI5",
		"icons": {
			"icon": "sap-icon://Fiori7/F1373",
			"favIcon": "icon/F1373_Approve_Purchase_Orders.ico",
			"phone": "icon/launchicon/57_iPhone_Desktop_Launch.png",
			"phone@2": "icon/launchicon/114_iPhone-Retina_Web_Clip.png",
			"tablet": "icon/launchicon/72_iPad_Desktop_Launch.png",
			"tablet@2": "icon/launchicon/144_iPad_Retina_Web_Clip.png"
		},
		"deviceTypes": {
			"desktop": true,
			"tablet": true,
			"phone": true
		}
	},
	"sap.ui5": {
		"dependencies": {
			"minUI5Version": "1.44.17",
			"libs": {
				"sap.ui.core": {},
				"sap.m": {},
				"sap.ui.layout": {},
				"sap.ushell": {}
			}
		},
		"models": {
			"i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"uri": "i18n/i18n.properties"
			},
			"": {
				"dataSource": "mainService",
				"settings": {
					"defaultCountMode": "Inline"
				}
			}
		},
		"rootView": "nw.epm.refapps.purchaseorders.approve.view.App",
		"config": {
			"sapFiori2Adaptation": true
		},
		"routing": {
			"config": {
				"routerClass": "sap.m.routing.Router",
				"viewType": "XML",
				"async": true,
				"viewPath": "nw.epm.refapps.purchaseorders.approve.view",
				"controlId": "approvalApp",
				"bypassed": {
					"target": [
						"master",
						"empty"
					]
				}
			},
			"routes": [
				{
					"pattern": "",
					"name": "main",
					"target": [
						"detail",
						"master"
					]
				},
				{
					"pattern": "PurchaseOrder/{POId}",
					"name": "PurchaseOrderDetails",
					"target": [
						"master",
						"detail"
					]
				}
			],
			"targets": {
				"master": {
					"viewName": "S2_PurchaseOrders",
					"viewLevel": 1,
					"controlAggregation": "masterPages"
				},
				"detail": {
					"viewName": "S3_PurchaseOrderDetails",
					"viewLevel": 2,
					"controlAggregation": "detailPages"
				},
				"summary": {
					"viewName": "S3_PurchaseOrderSummary",
					"viewLevel": 3,
					"controlAggregation": "detailPages"
				},
				"empty": {
					"viewName": "EmptyPage",
					"viewLevel": 3,
					"controlAggregation": "detailPages"
				}
			}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		}
	},
	"sap.platform.hcp": {
		"uri": "webapp",
		"_version": "1.1.0"
	},
	"sap.fiori": {
		"registrationIds": [
			"F1373"
		],
		"archeType": "transactional"
	}
}

0

What errors are you seeing?

Jamie

0
Former Member

Hi Jamie,

When I install the app I don't see message " “local store being provisioned”"

secondly, I can successfully access the app with all the Purchase orders documents when I am connected to internet, but when I am on flight mode then I get the error

Thanks

0

What is your goal with this app? As I mentioned above, the odata service as it is written now, is not compatible with the offline functionality due to missing field attributes. If this is for learning purposes then you may want to use the sample described in the blog.

Regards,

Jamie

0