我正在尝试使用 S/4HANA SDK 来调用 CompanyCode OData VDM 服务,但如果我在 Cloud Foundry 环境中执行此操作,则会收到附加的错误。我之前一直在使用 SDK,但没有发生这种情况。你能帮我吗?代码:public List<CompanyCode> findAll() { try { return compCodeService.getAllCompanyCode().execute(erp()) .stream() .map(this::toCompCode) .collect(Collectors.toList()); } catch (ODataException e) { throw SapException.create(e.getMessage()); }}private ErpConfigContext erp(){ return new ErpConfigContext(REPLICATE_WORKFORCE);} public static final String REPLICATE_WORKFORCE = "REPLICATE_WORKFORCE";
1 回答
青春有我
TA贡献1784条经验 获得超8个赞
你能试着确保RequestContextServletFilter在你的应用程序中被选中吗?在RequestContextServletFilter使用@WebFilter默认注释。
Spring Boot 示例:
@SpringBootApplication
@ServletComponentScan( "com.sap.cloud.sdk" )
public class Application extends SpringBootServletInitializer
{
...
}
另见:https : //docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/web/servlet/ServletComponentScan.html
编辑:请注意,在后台作业(不是由请求触发)中运行您的代码时,您必须使用RequestContextExecutor::execute.
添加回答
举报
0/150
提交
取消
