Skip to Content
0
Jun 17, 2020 at 10:01 AM

Exception in execution of BAPI using SAP Cloud SDK 3.18

38704 Views Last edit Jun 17, 2020 at 10:04 AM 2 rev

This is a follow up to my previous question posted on https://answers.sap.com/questions/13057648/exception-in-execution-of-bapi-using-sap-cloud-sdk.html. I am trying to call BAPI using SAP Cloud SDK version 3.18 using Java.

I have created a Spring Boot application for doing this. Below is the code which I am using:

@RequestMapping(value="/costCenters", method = RequestMethod.GET, produces ="application/json")
  private CostCenter getCostCenterDetails() throws RequestExecutionException{

  final Destination destination =DestinationAccessor.getDestination("ErpQueryEndpoint");
    final BapiRequestResult resultCostCenterDetail = new BapiRequest("BAPI_COSTCENTER_GETLIST1")
            .withExporting("CONTROLLINGAREA", "BAPI0012_1-CO_AREA", "0001")
            //.withExporting("COSTCENTER", "BAPI0012_1-COSTCENTER", chosenCostCenter.getId())
            .withImportingFields("COSTCENTERDETAIL", "BAPI0012_CCOUTPUTLIST").end()
            .withTableAsReturn("BAPIRET2")
            .execute(destination);
    return resultCostCenterDetail.get("COSTCENTERDETAIL").getAsObject().as(CostCenter.class);
  }

I have created RFC destination in CF and Cloud Connector. However When I am trying to execute it I am getting below error:

Caused by: com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: org.springframework.web.util.NestedServletException:Handler dispatch failed;nestedexceptionis java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException
	at com.sap.cloud.sdk.cloudplatform.thread.AbstractThreadContextExecutor.execute(AbstractThreadContextExecutor.java:325)~[cloudplatform-core-3.18.0.jar:na]at com.sap.cloud.sdk.cloudplatform.servlet.RequestAccessorFilter.doFilter(RequestAccessorFilter.java:71)~[servlet-3.18.0.jar:na]

I have tried adding jco dependencies but maven goal fails to execute as these dependencies are no longer available in maven repository. Could you please help me in resolving this.

Regards,

Kamalpreet