cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Query Javascript. importPackage Not found

Former Member
0 Kudos

Hi Experts,

I am trying to follow below example in an effort to convert JAVA classes of SP03 into javascript:

However, when I try accessing below URL from browser:

https://SMPURL:8083/gateway/odata/SAP/CUSTOMQUERYTEST;v=1/MedCareSuppliersSet?$filter=MedCareSupplie... eq 'California'

In server logs I get below error:

com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "FILTER" is not defined. (/CustomQueryTest/src/main/resources/script/MedCareSuppliersSet_SOAP_Query.js#77

I am attaching MedCareSuppliersSet_SOAP_Query.js file for reference. I am using SMP3 SP07.

Any idea why required package is not found although I am importing it.

Regards,

Affaan

Tags edited by: Jitendra Kansal (Moderator)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

We have fixed this issue. I am attaching the JS file in case someone else faces same issue. Still would request to author of to please comment on our fix and why the one mentioned in the blog was not working.

Best Regards,

Affaan

Answers (2)

Answers (2)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Looks like you have commented below line.. can you uncomment it and then try?

importPackage(com.sap.core.odata.api.uri.expression);



Former Member
0 Kudos

I tried with uncommenting it but still getting same message in server logs: FILTER not defined:


I am attaching complete project. Would appreciate if you could review it.


Regards,

Affaan

Former Member
0 Kudos

Also I would like to know how function importPackage works? It seems the parameter it is taking are JAVA packages. Is there any framework or script engine that is making JAVA package available in javascript files?

Regards,

PavelPenaz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Affaan,

Can you debug your custom script as per the SCN thread here and post your findings here?

Meanwhile I hope and could share some inputs here, as my understanding has been that importing com.sap.core.odata.api.uri.expression would be sufficient for getting access to FILTER/BINARY etc.

Thank you.

Pavel