I'm trying to access our S/4 on-premise system without any cloud services involved. I', connected to the VPN and can reach our S/4 system and successfully address the BP API service with Postman.
When I deploy my app, the whole thing works as well. However, I don't want to program blindly and start & test the whole thing from my local machine. Unfortunately it does not work...
Failed to get 'destination' service credentials from VCAP_SERVICES variable: no service binding found for service plan '(any)'. Please make sure to correctly bind your application to a service instance of the destination service.
and
Caused by: com.sap.cloud.sdk.cloudplatform.security.exception.TokenRequestFailedException: Failed to get destination service client identifier and secret. Please make sure to correctly bind your application to a destination service instance
Can I access the S4 directly with the cloud SDK, or do I need a destination service in the btp?
My application-local.yaml file looks like:
destinations:
s4:
name: s4
authentication-type: BASIC_AUTHENTICATION
url: 'https://ourS4URL'
user: USER
password: ZZZ
trust-all-certificates: true
Just to test it, I try to read out all destinations, but even here I get directly the above mentioned errors:
ScpCfDestinationLoader load = new ScpCfDestinationLoader();
Try<Iterable<ScpCfDestination>> destinations = load.tryGetAllDestinations();
// sysout etc.
The only difference to the deployed version is, that I start the application.yaml with the profile "cloud", instead of the "locale" like here. What have I forgotten? Or is it really not possible?
edit: Thats how I use my service in the deployed version:
HttpDestination httpDestination = DestinationAccessor.getDestination("s4").asHttp()
.decorate(DefaultErpHttpDestination::new);
final BusinessPartnerService service = new DefaultBusinessPartnerService();