We try to call the API API_BUSINESS_PARTNER
via our Java application. The Java implementation communicates with a SAPUI5 - Front End application, so that the data can be displayed via an app.
Through our On - Premise System it works without any problems and we also get back data. But via the application we get the error "No error field found in JSON" and the SCP - Log for ODataConnectivityUtil shows us that the respective user is not authorized.
Accordingly we tried to call an older one MMIM_MATERIAL_DATA_SRV
and it works without any problems. We get the same error message in API_PRODUCT_SRV
. So it doesn't seem to work with the new APIs in general.
Thank you, best regards.
Which version of the S/4HANA Cloud SDK are you using? This might be an issue that we had in an older version. Could you update to the latest release version and give it a try again?
Details on releases can be found here: https://sap.github.io/cloud-s4-sdk-examples/release-notes/
Hint: I would also suggest to use our virtual data model classes that we provide for invoking such OData services. You can find a blog post on this topic here: https://blogs.sap.com/2017/05/21/step-4-with-sap-s4hana-cloud-sdk-calling-an-odata-service/
Pls take a look in the S/4HANA OData log which you can find using transaction /iwfnd/error_log (put /n before it). Then you execute the OData call to provoke the error. If you then find an entry in the OData log, it does mean that the authentication to S/4HANA was succesful. Also then you would figure out mor error details. In case you do not find any entry, it is very likely that you are not authenticating correctly. In this case S/4HANA returns 401 and an HTML document as response payload.
Thanks again for the support.
We have solved the problem now. The problem is that the first metadata request is executed on the default client (client 100) although we have set "sap-client=200" in the destination configuration. Our passwords between the clients were different, so we received an authentication error.
We suspect that the "newer" API's will not be able to access the configuration for the destination from the SCP. So it probably worked with the older ones.
One problem for us was that the Cloud SDK does not take the client from the destination configuration (for the metadata request).
The other problem was that the error message "No error field found in JSON" was misleading.
Only by the tip with "ODataConnectivityUtil", we could see our authentication error. So thanks again.