SAP-samples / s4hana-ext-microservice

SAP Extensibility Explorer example: Validate Customer Addresses using a microservice.
http://tiny.cc/s4-ext-microservice
Apache License 2.0
5 stars 1 forks source link

Error when run the sample app in WebIDE #1

Closed jcortesp closed 3 years ago

jcortesp commented 4 years ago

Hi, I followed the steps sticking on the guides but when I run the app in SCP (run in browser) the following error appeared:

{ "requestUri": "/S4HC_BO_FaultyAddress/sap/opu/odata/sap/YY1_FAULTYADDRESS_CDS/$metadata", "statusCode": 403, "statusText": "", "headers": [], "body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">/IWFND/CM_CONSUMER/101<message xml:lang=\"en\">No authorization to access Service 'YY1_FAULTYADDRESS_CDS_0001'/SAP/YY1_FAULTYADDRESS_CDS0001F1B631EA21110620E005F1BBF2092CBE20200729005706.8609510For backend administrators: use ADT feed reader \"SAP Gateway Error Log\" or run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more detailsSee SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)" }

I think there is a problem in the code because the uri must be filled whit my S4hana tenat.

Thank you

grenik commented 4 years ago

Hello jcortesp,

I've moved your issue to this repository because it is the only sample that uses the CDS view that you've mentioned.

The error that you are getting is coming from SAP S/4HANA Cloud which means that your request has reached it via a respective destination on SAP Cloud Platform.

The error code HTTP 403 Forbidden and the error message No authorization to access Service 'YY1_FAULTYADDRESS_CDS_0001' usually mean one of the following:

  1. You didn't maintain Basic authentication details in the destination configuration or the username and/or the password are wrong. In your destination configuration, you must use the same username and password that are used in the respective communication arrangement in SAP S/4HANA Cloud: image Related setup guide steps are Create Communication Arrangement and Destination for SAP S/4HANA.

  2. Your technical user is locked due to numerous invalid authentication attempts, e.g. because you maintained a false password in your destination configuration and then launched the application several times. You can unlock the user using the "Display Technical Users" application in your SAP S/4HANA Cloud. If a user is locked, you will see a lock icon in the "Locked" column. In such case, select the user and click the "Unlock" button. image To be on the safe side, you can also click the "Edit" button and specify a new password. Then, maintain the new password in your destination.

When updating the destination configuration, please note that it takes several minutes until your application gets the updated configuration. If you try to open the application in the meantime, your technical user may get locked again because of outdated invalid authentication details. To ensure that the destination configuration is updated, you can restart the application manually as it is shown on the screenshot below: image

I think there is a problem in the code because the uri must be filled whit my S4hana tenat.

It won't be filled: HTML5 runtime on Neo "maps" a relative URL of your HTML5 application to a URL in your destination. The mapping is maintained in your application descriptor. To call your SAP S/4HANA Cloud system API, your application simply calls its relative path, e.g.

https://your-app-url/your-destination-relative-path/sap/opu/odata/sap/YY1_FAULTYADDRESS_CDS/

The call is then forwarded by the HTML5 runtime to your SAP S/4HANA Cloud tenant. You can read more about it here.

If it solves your problem, please feel free to close the issue.

Best regards, Nikolay

grenik commented 3 years ago

Closing the issue due to inactivity. Feel free to reopen it if the issue is still valid.