cancel
Showing results for 
Search instead for 
Did you mean: 

Custom javascript calls in Fiori Launchpad

jprovost
Explorer
0 Kudos

Greetings scn folks,

I'm pretty much new to this whole SAP/SAPUI5/Fiori world and I have to implement a barcode scanner that will be used as an extra input device for some Fiori apps. The device comes with a plugin that can be initialized via javascript calls. I'm looking for a way to implement those calls + callbacks into the Fiori launchpad shell, so that the device can be used in every Fiori apps without having to add extra code in each one of them.

Is this something that can be achieved or am I daydreaming?

I'm currently exploring in SAP WEB IDE, created an extension project for flpportal but really not excited of where this is going yet...

Any help welcome!

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

just make it as lib and deploy to your server, you can use it where it is needed.

putting it in launchpad doesn't mean it can be used in every app

jprovost
Explorer
0 Kudos

I thought libraries were meant for UI controls... All I need is a central point where to put some lines of javascript that have nothing to do with UI. Turning the scanning device on and redefining scanning callbacks is what I want to do.

Also worth mentionning, the scanner device is a iPod 'sleeve', and the said plugin has been integrated with the fioriClient on the iPod. This makes the plugin class accessible from the apps in the fioriClient's launchpad (already tested). So yes, I thought if there was some way to lay that javascript somewhere in the launchpad, any app launched from it would recognize the callbacks, why wouldn't they?

junwu
Active Contributor
0 Kudos

lib can be anything...

you just call it, why it has to sit in launchpad.....

sap.ui.define(["yourscannerjs", 

that's right? i believe it will be loaded once, no matter how many app are using it in launchpad case, i could be wrong.

jprovost
Explorer
0 Kudos

I want the code to be called before any app is launched. Let's say it's legit to put my javascript in a library, where do I include it and run the code inside before opening the fiori apps if not in the launchpad?

junwu
Active Contributor
Ryan-Crosby
Active Contributor
0 Kudos

Hi Joel,

If you were to take an approach like that it might end up being something that you would have to refactor each time the cloud platform has an upgrade that impacts the fiori launchpad.  Better off creating a fragment view or component and deploying such that you can refer to it from any application that you choose to add the bar code scanning functionality.

Regards,

Ryan Crosby

jprovost
Explorer
0 Kudos

I don't understand why some custom javascript extension on the launchpad would require refactor because of some core updates and not the apps inside it. I thought the principle of 'extension' was to make custom logic independant from the core structure...

Ryan-Crosby
Active Contributor
0 Kudos

Hi Joel,

At the end of the day you would still need to invoke some API to initialize the bar code scanning functionality.  Given the fact that this API is pretty simple I'm not sure what you are thinking to gain by using extensions to fit this into the Fiori Launchpad - a few lines of code and you have a scanner invoked and then you are only calling it from an application that requires that functionality.  We recently had an issue where the latest launchpad updates broke the custom theme that we had created even though it is not supposed to affect it.

Regards,

Ryan Crosby

jprovost
Explorer
0 Kudos

We want the scanner to always fill the input field which have focus (with a fallback if not a text field) and trigger a 'enter', regardless of the app. If we can't implement this in the launchpad, there is several apps (and more to come in a long stretch of time) for which I'll have to create the same extension. So I guess the gain would be to not have to keep a list of the every apps using this extension. My logic tells me to implement this on a higher level, simple as that. And I guess the fragment view or component I'd create could also be broken by some updates even if it's not supposed to, so still not sure I quite grasp the risks of doing it higher level.

But IF I'd be the shameless kind of guy who would still like to do it, how could something like that be implemented?

Thanks for your answers by the way

Ryan-Crosby
Active Contributor
0 Kudos

Hi Joel,

I can't say as far as embedding the logic into the Fiori launchpad but I know that you can build it as a component and then refer to that component in each application.  The only thing you would have to do at that point is provide some way for the parent application to have the data placed into the proper input field because of how the component container concept works (You could try the focus stuff with jQuery but not sure if it will work as expected).  I understand the idea of pushing that to a higher level but any extension of a standard application comes at a risk and the Fiori launchpad is the bread and butter of the client access so I wouldn't ever try to modify that application personally.

I have used the component container in a reusable view for a configuration page that is deployed to several applications.  Still in development technically but conceptually it works as expected:

https://help.sap.com/saphelp_nw74/helpdata/en/18/2ab413eb54433eb16f1ecf15a00651/content.htm

Regards,

Ryan Crosby