cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Formatter function not found

RAF
Active Contributor
0 Kudos

Hi,

i have created a newly FIORI App via VS-Code and added the attachment service.

Now i need to integrate a formatter fucntion which is then not found.

Here is my manifest.json

And here is my formatter function

Debugger says

I think i am missing some declaration.

Any ideas how to solve this issue?

Thanks

Robert

meriton
Explorer
0 Kudos

Maybe you can share the git url with us, it would be easier to help mate

0 Kudos

hello Robert,

Did you find a solution ?

I am facing exactly same issue while using formatter from manifest.json for the reuse of attachment service.

best regards,

RAF
Active Contributor
0 Kudos

Hi,

indeed i did 🙂

I moved the coding from above from a seperat formatter.js to the existing component.js.

I think there should be also a way to integrate different .js files to sturcure the code better - but i don't know how.

Kind regards

Robert

0 Kudos

Good to know that the issue was resolved. 🙂

Can you please share the snippet on how you referred to the function from manifest ( under the embeddedComponents ), as still i am getting the formatter function not found.

best regards,

RAF
Active Contributor
0 Kudos

Hi,

here is my screenshot from the manifest.json.

Hope this helps you in resolving your issue

DiegoValdivia
Participant
0 Kudos

I found another solution. Instead of adding the formatter code inside the component, just declare the dependency inside the Component itself.

Following solution worked to me (My formatter code is inside folder webapp/ext/util):

This is my Manifest code:

"embeddedComponents": {
"simple::Attachments": {
"id": "simple::Attachments",
"componentName": "sap.se.mi.plm.lib.attachmentservice.attachment.components.stcomponent",
"title": "{{Attachments}}",
"settings": {
"mode": "{= ${ui>/editable}?'C':'D'}",
"objectType": "ZQMEL",
"objectKey": "{parts:[{path:'MaintenanceNotification'},{path:'DraftUUID'}],formatter:'ztest.ext.util.formatter.returnAttachmentKey'}",
"documentType": "ZP1"
}
}
}

And this is my component code. I'm just declaring the formatter dependency, I'm not actually using the formatter in the component.

sap.ui.define([
"sap/suite/ui/generic/template/lib/AppComponent",
"sap/ui/model/json/JSONModel",
"sap/ui/Device",
"./ext/util/formatter"],
function (Component, JSONModel, Device, Formatter) {
"use strict";

return Component.extend("ztest.Component", {
metadata: {
manifest: "json"
},

I hope it helps.

Accepted Solutions (0)

Answers (3)

Answers (3)

ThorstenHoefer
Active Contributor
0 Kudos

Hi,

please check how to define classes:

sap.ui.define([], function () {
	"use strict";
	return {
		statusText: function (sStatus) {
			var resourceBundle = this.getView().getModel("i18n").getResourceBundle();
			switch (sStatus) {
				case "A":
					return resourceBundle.getText("invoiceStatusA");
				case "B":
					return resourceBundle.getText("invoiceStatusB");
				case "C":
					return resourceBundle.getText("invoiceStatusC");
				default:
					return sStatus;
			}
		}
	};
});

Step 23: Custom Formatters | SAP Help Portal

abo
Active Contributor
0 Kudos
return {        returnAttachmentKey: function (....) {

instead of the following (see example)

returnAttachmentKey: function...
RAF
Active Contributor
0 Kudos

Hi,

sorry do not work syntacticly

junwu
Active Contributor
0 Kudos

in your declare, you have "Component" in the name, probably you have to remove it.

RAF
Active Contributor
0 Kudos

Hi,

this i also tried with no success.

junwu
Active Contributor
0 Kudos

how about this?

junwu
Active Contributor
0 Kudos

add it to the dependency of your component definition if it is still not working