cancel
Showing results for 
Search instead for 
Did you mean: 

$.response.body undefined in xsjs Hana

e_giunta
Participant
0 Kudos

Hello experts,

I want to read response of Northwind oData with xsjs and then put some of that values in hana mdc table, but i found this error trying to retrieve response. Suggestions?hanamdcxsjs.png

Accepted Solutions (0)

Answers (2)

Answers (2)

pfefferf
Active Contributor

You are executing the xsjs via a scheduled job. The $.response object is only available in a web session (when you call the xsjs e.g. via a browser), but not when it is executed as job. If you wanna "return" something in your case, you have to persist the necessary information.

e_giunta
Participant
0 Kudos

Thanks for answer Florian. Can you suggest a solution?

pfefferf
Active Contributor
0 Kudos

The solution depends on what you wanna do? As said you cannot use the $.response object to return the result of the API call, because the xsjs coding is executed as job. Maybe if you share more details about your use case (who uses that, why it has to be executed as job ...) hints can be given for a more appropriate direction.

e_giunta
Participant
0 Kudos

Thanks Florian; so the scenario is the following: I want to retrieve data from odata response and put this data in the table on hana mdc. My problem is how to retrieve odata response in xsjs executed as a job.

pfefferf
Active Contributor
0 Kudos

Then if you wanna store the data, why trying to return the result in the response body (as mentioned $.response is not available). Actually it seems that the determination of the result provided by the external OData API call works, and just the setting of response body fails. Replace the logic in your coding using the $.response with the logic to store the data, than it should/will work.

chenna_koyyagura
Explorer
0 Kudos

Hi,

I faced the same issue; As xsjob unabled to understand the $.response statements, we need to comment those lines then after it worked fine for me. If I understood your requirement correctly, you need to write some script to parse the response(for instance; XML or JSON or Tab separated Values response) and construct proper records and insert them into Hana tables.

Kind regards

Chenna