cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori extension: Need to have a custom javascript function

Former Member
0 Kudos

Hi,

      Have extended SAP Approve PO app, everything works fine. However need to have a custom java script function to validate PO type.

To do that we use:

<form:FormContainer  title="PC data"

                                     visible="{parts : [{path : 'ZZPOTYPE'}], formatter : 'ui.s2p.mm.purchorder.approve.util.Conversions.commonFieldVisibilityTrigger'}">

Here, FORMATTER is called from the standard app Conversions.js under UTIL folder:

1. Could we extend the Conversions.js or

2. Couls we create one in extension app?

Regards,

Kevin Dass

Message was edited by: Michael Appleby

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

sure you can create one, just place it in the right folder structure and dont forget to declare it

jQuery.sap.declare("your.own.very.special.Formatter");

Former Member
0 Kudos

Thanks for your reply Maksin.

I did do the same, let me share it.

santhu_gowdaz
Active Contributor
0 Kudos

check your name space in index.html and component.js,

<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{"HERE IT SHOULD MATCH": "./"}'>

</script>

jQuery.sap.declare("HERE IT SHOULD MATCH.Component");

jQuery.sap.require("HERE IT SHOULD MATCH.MyRouter");

sap.ui.core.UIComponent.extend("HERE IT SHOULD MATCH.Component", {

Former Member
0 Kudos

Thanks Santhosh, however didn't get you on this. Could you please detail out?

santhu_gowdaz
Active Contributor
0 Kudos

Check out your index.html and component.js,

"HERE IT SHOULD MATCH" - This is the name space, it should match every where.

Former Member
0 Kudos

Please find the code(Couldn't find the "jQuery.sap.require("HERE IT SHOULD MATCH.MyRouter");" in the extension app )

santhu_gowdaz
Active Contributor
0 Kudos

Leave about "jQuery.sap.require("HERE IT SHOULD MATCH.MyRouter")" because you are not using Router Concept and "MyRouter.js" is not available in your project.

Former Member
0 Kudos

Thank you Santhosh, however would you let me know if the previous approach is correct? if not let me know.

Adding to it, I have achieved this functionality in a new app but it seems not working in an Fiori extension app.