0

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();
Tobias
  • 4,921
  • 4
  • 31
  • 40

1 Answers1

1

As you are able to access the on-premise system directly, instead of making use of the Destination service you could choose to create a Destination programmatically and register it so that the DestinationAccessor is able to furnish the details of this destination. Please read more about this option here.

Alternatively, you can also set an environment variable for your destination: (Example is for Windows, please adapt according to your OS)

$destinations='[{name: "MyErpSystem", url: "https://URL", "username": "USER", "password": "PASSWORD"}]'

Both of these methods ensure that the DestinationAcessor returns a valid Destination (of your S/4 on-premise system).

Ksivakumar
  • 188
  • 1
  • 7
  • Did not work, but I was able to connect to the BTP-Destination-Service via cf ssh. Now I can talk to our in prem service from my local dev. – Tobias Apr 18 '23 at 11:58