2025 Mar 13 8:16 AM - edited 2025 Mar 13 8:17 AM
Hello,
I'm following this official SAP tutorial: Connect to OData Service on Cloud Foundry Using SAP Cloud SDK
But I struggle to connect to Production order API. This is the official SAP data for this API.
I'm trying to connect to API_PRODUCTION_ORDER_2_SRV but i get this error: The HTTP response code (403) indicates an error. The OData service responded with an error message.
This my Java code:
@RequestMapping( value = "/getProductionOrders", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE )
public ResponseEntity<?> getProductionOrders() {
// DESTINATION 3: Destination to a SAP S/4HANA Cloud (public edition) tenant
// Uncomment this section to test with actual SAP S/4HANA Cloud
try {
final HttpDestination destination = DefaultDestination.builder()
.property("Name", "mydestination")
.property("URL", URL)
.property("Type", "HTTP")
.property("Authentication", "BasicAuthentication")
.property("User", USER_NAME)
.property("Password", PASSWORD)
.property("trustAll", "true")
.build().asHttp();
final List<ProductionOrder> productionOrders =
new DefaultOPAPIPRODUCTIONORDER2SRV0001Service()
.getAllProductionOrder_2()
.select(ProductionOrder.ALL_FIELDS)
.filter(ProductionOrder.ORDER_IS_RELEASED.eq(""))
.orderBy(ProductionOrder.PLANNED_START_DATE, Order.ASC)
.top(200)
// TODO: uncomment the line below, if you are using the sandbox service
// .withHeader(APIKEY_HEADER, SANDBOX_APIKEY)
.executeRequest(destination);
logger.info("Found {} production orders(s).", productionOrders.size());
return ResponseEntity.ok( new Gson().toJson(productionOrders));
} catch (final DestinationAccessException e) {
logger.error(e.getMessage(), e);
return ResponseEntity.internalServerError().body("Failed to fetch destination.");
} catch (final ODataException e) {
logger.error(e.getMessage(), e);
return ResponseEntity.internalServerError().body("Failed to fetch production orders.");
} catch (final Exception e) {
logger.error(e.getMessage(), e);
return ResponseEntity.internalServerError().body("Unexpected error occurred while fetching production orders.");
}
}Where URL is https://xxx.sap.xxx.com:44300/sap/opu/odata/sap/API_PRODUCTION_ORDER_2_SRV . (where xxx is hidden sensitive data). USER_NAME and PASSWORD are correct.
When i open the link in the browser I get this message:
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code>/IWFND/MED/170</code> <message xml:lang="en">No service found for namespace '', name 'API_PRODUCTION_ORDER_2_SRV', version '0001'</message> <innererror> <application> <component_id/> <service_namespace>/SAP/</service_namespace> <service_id>API_PRODUCTION_ORDER_2_SRV</service_id> <service_version>0001</service_version> </application> <transactionid>FFDF28B1D31D03B0E0067D1EBED7E3BE</transactionid> <timestamp>20250313070041.3805890</timestamp> <Error_Resolution> <SAP_Transaction>For 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 details</SAP_Transaction> <SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note> </Error_Resolution> <errordetails/> </innererror> </error> |
Based on the provided data can you help solve the problem and/or suggest how to successfully connect to Production Order API
Thanks, Nick
Request clarification before answering.
| User | Count |
|---|---|
| 13 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.