cancel
Showing results for 
Search instead for 
Did you mean: 

Error failed to preload 'sap.cus.crm.lib.reuse.library-preload': NOT FOUND

Former Member
0 Kudos

Hi All,

I have extended CRM My appointments app in Web IDE. I modified the neo.json file in the Web IDE and added the below

{

      "path": "/webapp/resources/sap/cus/crm",

      "target": {

        "type": "destination",

        "name": "XXX",

        "entryPath": "/sap/bc/ui5_ui5/sap/crm_lib_reuse/sap/cus/crm"

      },

      "description": "CRM Lib Reuse"

    }

The extended application works fine when executed from the Web IDE.

Now when I deploy this extended app on the ABAP server and configure it in a Fiori launchpad, it gives the below error while executing -

Error: failed to load 'sap/cus/crm/lib/reuse/library.js' from /sap/bc/ui5_ui5/ui2/ushell/resources/sap/cus/crm/lib/reuse/library.js: 404 - NOT FOUND

Can anyone please help me with this issue ?

Many thanks in advance,

Regards,

Vivek

Accepted Solutions (1)

Accepted Solutions (1)

michal_keidar
Active Contributor

Add this code to the extended app's Component.js, right after the first line:

(function() {

jQuery.sap.registerModulePath("sap.cus.crm.lib.reuse", "/sap/bc/ui5_ui5/sap/crm_lib_reuse/sap/cus/crm/lib/reuse");

}());


Regards,
Michal.

Former Member
0 Kudos

Thanks Mical this worked. But would you have an idea why I had this issue only with appointments, I added a reference to neo.json file for Opportunities and Tasks as well, both of them worked fine in the launchpad. Only appointments had this issue.

Thanks,

Vivek

michal_keidar
Active Contributor
0 Kudos

I'm not sure. Anyway like Rotem said the neo-app.json doesn't play a role in the ABAP system.

Former Member
0 Kudos

Thanks Michal.

Is possible could you please help me with an other issue I have -

Thanks,

Vivek

Answers (1)

Answers (1)

0 Kudos

Hi Vivek,

The ABAP server is not using neo-app.json to resolve application routes. This file is relevant only for HANA Cloud Platform applications.

In the original application code I see in the Component.js the following code:

(function() {

  var sPath = jQuery.sap.getModulePath("cus.crm.mycalendar");

  if (sPath.toLowerCase().indexOf("crm_mycal") !== -1) {

  if (sPath.lastIndexOf("/") !== sPath.length - 1) {

  sPath += "/";

  }

  jQuery.sap.registerModulePath("sap.cus.crm.lib.reuse",

  sPath + "../crm_lib_reuse/sap/cus/crm/lib/reuse");

  }

}());

(You can import the application into the Web IDE and see it yourself)

I guess that if you will add this to the code of the extension project's Component.js it will work as well on the ABAP server.

Can you try and update if it helps?

Thanks,

Rotem

Former Member
0 Kudos

Thanks Rotem for the hint.

I tried it, but it did not work. When I execute the custom tile I dont see "component.js" being called, but my changes are visible.

I tried with both of the below options but it did not work.

(function() {

  var sPath = jQuery.sap.getModulePath("cus.crm.mycalendar");

  if (sPath.toLowerCase().indexOf("crm_mycal") !== -1) {

  if (sPath.lastIndexOf("/") !== sPath.length - 1) {

  sPath += "/";

  }

  jQuery.sap.registerModulePath("sap.cus.crm.lib.reuse",

  sPath + "../crm_lib_reuse/sap/cus/crm/lib/reuse");

  }

}());

(function() {

  var sPath = jQuery.sap.getModulePath("cus.crm.mycalendar");

  if (sPath.toLowerCase().indexOf("zcrm_mycal") !== -1) {

  if (sPath.lastIndexOf("/") !== sPath.length - 1) {

  sPath += "/";

  }

  jQuery.sap.registerModulePath("sap.cus.crm.lib.reuse",

  sPath + "../crm_lib_reuse/sap/cus/crm/lib/reuse");

  }

}());

Please help.

Thanks,

Vivek

Former Member
0 Kudos

Hi Rotem,

I debugged standard code and this is the issue I found -

In the method below, the value of sPath is " /sap/bc/ui5_ui5/sap/CRM_MYCAL"

Note that "CRM_MYCAL" is in capital letters, if it had been "crm_mycal", it would have successfully registered and worked fine.

(function() {

  var sPath = jQuery.sap.getModulePath("cus.crm.mycalendar");

  if (sPath.toLowerCase().indexOf("crm_mycal") !== -1) {

  if (sPath.lastIndexOf("/") !== sPath.length - 1) {

  sPath += "/";

  }

  jQuery.sap.registerModulePath("sap.cus.crm.lib.reuse",

  sPath + "../crm_lib_reuse/sap/cus/crm/lib/reuse");

  }

}());

So now the question is, why does jQuery.sap.getModulePath("cus.crm.mycalendar") return "/sap/bc/ui5_ui5/sap/CRM_MYCAL" and NOT "/sap/bc/ui5_ui5/sap/crm_mycal"

Can you please throw some light where can I check this ?

Thanks,

Vivek

Former Member
0 Kudos

On further debugging I found that standard SAP code registers the crm_mycal component twice, the first one is correct, but the second one is with capital letters and this is causing the issue.

2016-02-26 21:11:28 registerResourcePath ('cus/crm/mycalendar', '/sap/bc/ui5_ui5/sap/crm_mycal/') -  sap.ui.ModuleSystem core-min-0-dbg.js:15226

2016-02-26 21:11:28 registerResourcePath ('cus/crm/mycalendar','/sap/bc/ui5_ui5/sap/CRM_MYCAL/') -  sap.ui.ModuleSystem

Yet to figure out why this happens

Thanks,

Vivek