标签: s4sdk

更新请求不再将所有字段发送到SAP S/4 HANA系统

自从更新到Cloud SDK版本2.0.0以来,我们现在遇到了向请求添加字段的问题.它主要是关于"计算实际库存凭证项目"的流程步骤.这里,项目的手动设置属性不会发送到请求中.

这些是我们实际设置并发送到S4系统的属性:

Java编码

这些是嵌入在查询中的属性:

请求S4

sap s4sdk

8
推荐指数
1
解决办法
93
查看次数

无法将工件上传到Nexus存储库 - S4SDK管道

我正在尝试使用Jenkins管道中的Artifact部署阶段将工件上传到Nexus存储库.为此,我向Jenkins提供了Nexus凭据以及查找存储库的路径.但是,这个阶段失败了,错误"连接被拒绝连接".

但是,我可以在http:// localhost:8081/nexus上访问Nexus .

下面是pipeline_config.yml文件中使用的代码.

artifactDeployment:
    nexus:
      version: nexus2
      url: 'http://localhost:8081/nexus/'
      repository: myrepo
      credentialsId: 'nexus'
      additionalClassifiers:
        - type: jar
          classifier: classes
Run Code Online (Sandbox Code Playgroud)

截图

有人可以建议你解决这个问题吗?

s4sdk

7
推荐指数
1
解决办法
407
查看次数

如何在现有应用程序中使用SAP S/4HANA Cloud SDK访问OData服务?

我有一个通过调用该系统API(OData的服务)与SAP S/4HANA云(我公司的ERP系统)集成在SAP云平台Cloud Foundry的Java应用程序.我听说过SAP S/4HANA Cloud SDK,它使这些场景变得更加容易.

如何利用SAP S/4HANA Cloud SDK?目前,我调用SAP S/4HANA的代码对于检索产品主数据的方案看起来像这样(简化并连接在一起).我自己创建了这个S4Product类作为响应的表示.该baseUrlauthHeader被谈论到SAP云平台的目标服务之前确定.

StringBuilder url = new StringBuilder(baseUrl);
url.append("/sap/opu/odata/sap/API_PRODUCT_SRV/A_Product");
url.append("&$select=Product,CreationDate");
url.append("&$filter=ProductType eq '1'");
url.append("&$top=10");

URL urlObj = new URL(url.toString());
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Authorization",authHeader);

connection.setDoInput(true);

final InputStreamReader in = new InputStreamReader(connection.getInputStream());
String response = CharStreams.toString(in);

List<S4Product> result = Arrays.asList(new Gson().fromJson(response, S4Product[].class));
Run Code Online (Sandbox Code Playgroud)

现在我被要求与商业伙伴做类似的事情.如何使用SDK 为业务合作伙伴OData服务执行此操作?如果我想使用SDK,是否必须创建新的应用程序?

s4sdk

7
推荐指数
1
解决办法
486
查看次数

未知异常"null-解析元数据时出错." 执行DefaultSalesOrderService()时 - updateSalesOrder()

作为PoC的一部分,我目前正在尝试为S/4HANA Cloud的并行扩展构建原型,包括两个层:使用S/4HANA Cloud SDK与Java后端分离的SAPUI5前端.

总的来说它也很棒.但是我经常遇到UPDATE命令的问题,所以我为了演示目的编写了一个小的servlet.现在,我总是在更新期间得到相同的异常,即"解析元数据时出错".

我已经尝试了一切,现在不知道这个异常的触发器是什么.

我试图在pom.xml中添加更多依赖项,但这没有成功.尝试使用GET命令获取所有字段并更新填充的对象也是不成功的.ETag也不是问题,这是自"versionIdentifier"最新发布以来的优秀处理.

如果你们其中一个人知道我的错误在哪里,我将非常感激!

在此先感谢您的帮助!

[OLD] Code Snippet:公共类UpdateService扩展了HttpServlet

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // Test-Run: UPDATE
    response.getWriter().write("Test-Run: UPDATE" + "\n");

    // Prepare the S/4HANA Cloud Service
    DefaultSalesOrderService service = new DefaultSalesOrderService();

    // Prepare the required Variables
    String salesOrderKey = "1";
    String deliveryBlockReason = "01";
    SalesOrder salesOrder;

    try {

        // Get the Sales Order
        response.getWriter().write("Step 1: Get old data.." + "\n");
        salesOrder = service.getSalesOrderByKey(salesOrderKey).select(SalesOrder.DELIVERY_BLOCK_REASON).execute();

        // Output: …
Run Code Online (Sandbox Code Playgroud)

sap metadata odata s4sdk

6
推荐指数
1
解决办法
211
查看次数

使用S/4HANA Cloud SDK> = 2.0.0执行OData查询时的DestinationAccessException

我正在尝试使用VDM从使用VDM的S/4HANA Cloud 1805系统读取数据,如https://blogs.sap.com/2017/05/21/step-4-with-sap-中所述s4hana-cloud-sdk-calling-an-odata-service /.目标使用基本身份验证.

示例电话:

final ErpConfigContext context = new ErpConfigContext("...");
return new DefaultQualityInspectionDataService().getAllInspectionLot().select(...).execute(context);
Run Code Online (Sandbox Code Playgroud)

这至少在S/4HANA Cloud SDK版本1.9.4之前有效.由于更新到2.0.0,由于以下异常,目标无法再使用:

2018 06 18 12:43:55#+00#ERROR#org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/app-application].[com.sap.cloud...Servlet]##anonymous#https-jsse-nio-8041-exec-3#na#a078260ed#app#web#a078260ed#na#na#na#na#Allocate exception for servlet [com.sap.cloud...Servlet] com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get ConnectivityConfiguration: no RequestContext available. Have you correctly configured a RequestContextFactory or have you wrapped your logic in a RequestContextExecutor when executing background tasks that are not triggered by a request?
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getConnectivityConfiguration(ScpNeoDestinationFacade.java:60)
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getDestinationConfiguration(ScpNeoDestinationFacade.java:108)
at com.sap.cloud.sdk.cloudplatform.connectivity.ScpNeoDestinationFacade.getGenericDestination(ScpNeoDestinationFacade.java:183)
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.getGenericDestination(DestinationAccessor.java:136)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:218)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:367)
at com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext.<init>(ErpConfigContext.java:442)
at com.sap.cloud...Servlet.<init>(...Servlet.java:31)
...
at java.lang.Thread.run(Thread.java:808) …
Run Code Online (Sandbox Code Playgroud)

java s4sdk

5
推荐指数
1
解决办法
322
查看次数

使用Gradle时,依赖关系将两次放入Spring Boot(> 2.x)jar

为CF添加这样的云SDK: compile "com.sap.cloud.s4hana:s4hana-all:${cloudSDKVersion}" compile ("com.sap.cloud.s4hana.cloudplatform:scp-cf:${cloudSDKVersion}") 导致弹簧启动jar中的重复jar,它被部署到CF. 例子: core-2.3.1.jar connectivity-2.3.1.jar

  • 这导致 :
    • 运行时期间的ClassNotFoundExceptions
    • 防止cf push命令出错: Comparing local files to remote cache... Aborting push: File BOOT-INF/lib/core-2.3.1.jar has been modified since the start of push. Validate the correct state of the file and try again. FAILED

s4sdk

3
推荐指数
1
解决办法
230
查看次数

SAP Cloud Foundry 中的远程调试

我想知道如何远程调试部署在 SAP Cloud Foundry 中的 S4SDK/Spring 2.0.6 Java 应用程序。

我正在使用 Eclipse(Spring Tool Suite)并在调试模式下启动应用程序。应用程序将使用以下环境变量重新启动: -Dspring.devtools.remote.secret=secret -Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n,address=47822

控制台输出显示,启动后 SSH 隧道已自动创建成功(作为先决条件,我已使用 cf enable-ssh 启用了 SSH)。和“10.0.136.5:34858 的成功远程访问”。

几秒钟后,eclipse 显示消息“无法连接到远程 VM”。

如何启用远程调试?

java eclipse cloud-foundry s4sdk sap-cloud-platform

3
推荐指数
1
解决办法
1234
查看次数

DestinationAccessException在云代工环境中使用S4 SDK执行ODATA V2调用时出错

用于执行呼叫的目的地被配置为认证类型为oAuth2SAMLBearerAssertion,业务用户已经在系统中具有用户ID,电子邮件和其他基本详细信息.从SDK调用execute方法我得到以下错误:

Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get authentication headers. Destination service returned error: Provided authorization grant is invalid. Exception was No user found with alias 'name@domain.com' (format: unspecified). For more information, consult the kernel traces or the OAuth 2.0 troubleshooting SAP note 1688545.
Run Code Online (Sandbox Code Playgroud)

s4sdk

1
推荐指数
1
解决办法
79
查看次数

如何在VDM中获取本地化字段的文本?

我正在尝试使用VDM从我们的S/4HANA云(公共云)获取业务合作伙伴数据.

        final List<BusinessPartner> businessPartners =
                new DefaultBusinessPartnerService()
                        .getAllBusinessPartner()
                        .select(BusinessPartner.BUSINESS_PARTNER,
                                BusinessPartner.BUSINESS_PARTNER_NAME)
                        .filter(BusinessPartner.BUSINESS_PARTNER_CATEGORY.eq("2"))
                        .orderBy(BusinessPartner.BUSINESS_PARTNER, Order.ASC)
                        .execute();
Run Code Online (Sandbox Code Playgroud)

正确显示英文业务伙伴名称.但日本商业伙伴名称显示为?????.

{"BusinessPartner":"80000001","BusinessPartnerName":"Domestic US Customer 1"},
{"BusinessPartner":"80000002","BusinessPartnerName":"?????????????"},
{"BusinessPartner":"90000001","BusinessPartnerName":"Domestic US Supplier 1"},
{"BusinessPartner":"90000002","BusinessPartnerName":"????????"}
Run Code Online (Sandbox Code Playgroud)

你能给我建议如何获取本地化字段的文本吗?

谢谢.

(补充说明)

我用Postman手动执行了OData.在这种情况下,本地化字段以日语显示.

https://myXXXXXX.s4hana.ondemand.com/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$select=BusinessPartner,BusinessPartnerName&$orderby=BusinessPartner&$filter=BusinessPartnerCategory%20eq%20'2'&$format=json&saml2=disabled
Run Code Online (Sandbox Code Playgroud)

产量

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000001')",
                    "uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000001')",
                    "type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
                },
                "BusinessPartner": "80000001",
                "BusinessPartnerName": "Domestic US Customer 1"
            },
            {
                "__metadata": {
                    "id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000002')",
                    "uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('80000002')",
                    "type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
                },
                "BusinessPartner": "80000002",
                "BusinessPartnerName": "?????????"
            },
            {
                "__metadata": {
                    "id": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000001')",
                    "uri": "https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('90000001')",
                    "type": "API_BUSINESS_PARTNER.A_BusinessPartnerType"
                },
                "BusinessPartner": …
Run Code Online (Sandbox Code Playgroud)

s4sdk

1
推荐指数
1
解决办法
96
查看次数

如何使用OAuth2SAMLBearerAssertion在Neo SCP到Cloud Foundry服务中设置目标?

我想使用带有OAuthSAMLBearerAssertion的目标在Neo SCP中使用CF服务。

但是每次我在WebIDE中检查服务时,都会出现错误500。

这是我的目的地:

#clientKey= Client-ID of your OAuth client
--> you will get the clientid from environment variables in CF: 
--> xsuaa --> credentials --> clientid
#tokenServicePassword=  Client secret of your OAuth client
--> you will get the clientsecret from environment variables in CF: 
--> xsuaa --> credentials --> clientsecret
#Tue May 21 07:02:37 UTC 2019
Description=CF HANA OData Service
Type=HTTP
TrustAll=true
audience=xyz.aws-live-eu10 (=EntityID out of the SAML metadata)
Authentication=OAuth2SAMLBearerAssertion
WebIDEUsage=odata_gen
Name=cf_xyz_odata_auth
WebIDEEnabled=true
tokenServiceURL=https\://xyz.authentication.eu10.hana.ondemand.com/oauth/token/alias/xyz.aws-live-eu10 (= Token URL out of …
Run Code Online (Sandbox Code Playgroud)

s4sdk sap-cloud-sdk

0
推荐指数
1
解决办法
401
查看次数