Skip to Content
avatar image
Former Member

how to call a JSView from an XSJS file?

I know I can call other JS files from XSJS by making a .xsjslib file. I would like to be able to call a JSView instead. Is this possible?

Note: the reason for me to this is that I can then use the sapui5 libraries and make it easier to import external libraries to my code.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 12, 2017 at 09:32 PM

    I'm afraid it doesn't work like that. XSJS executes on the server side and SAPUI5 executes on the client side. A small block of code you might isolate and rewrite as XSJSLIB, but that's the only way to reuse JavaScript in XSJS in XSC. If you really want to use external modules in XSJS, I suggest migrating to XS Advanced. There the XS runtime is based upon Node.js and you can call external node modules with the $.require API.

    Add comment
    10|10000 characters needed characters exceeded