1

我正在尝试使用 SAP Cloud SDK 创建一个业务合作伙伴,包括客户、客户销售区域和客户公司。

这就是我创建我的业务伙伴 vdm 的方式:

 final CustomerSalesArea customerSalesArea = CustomerSalesArea.builder()
                .salesOrganization("YOD1")
                .distributionChannel("Y2")
                .division("Z1")
                .currency("EUR")
                .customerAccountAssignmentGroup("01")
                .customerPaymentTerms("0001")
                .customerPricingProcedure("Y1")
                .incotermsClassification("FH")
                .itemOrderProbabilityInPercent("100")
                .orderCombinationIsAllowed(true)
                .customerAccountGroup("CUST")
                .build();

        final CustomerCompany company = CustomerCompany.builder()
                .companyCode("YOD1")
                .reconciliationAccount("0012100000")
                .customerAccountGroup("CUST")
                .build();

        final Customer customer = Customer.builder()
                .customerSalesArea(customerSalesArea)
                .customerCompany(company)
                .build();

        final BusinessPartner businessPartner = BusinessPartner.builder()
                .firstName(oxidBusinessPartner.getFirstName())
                .middleName(oxidBusinessPartner.getMiddleName())
                .lastName(oxidBusinessPartner.getLastName())
                .businessPartnerCategory("1")
                .correspondenceLanguage("DE")
                .businessPartnerIDByExtSystem(oxidBusinessPartner.getCustomerId())
                .customer(customer)
                .build();

        final BusinessPartnerRole businessPartnerRole1 = BusinessPartnerRole.builder()
                .businessPartnerRole("FLCU00")
                .build();

        final BusinessPartnerRole businessPartnerRole2 = BusinessPartnerRole.builder()
                .businessPartnerRole("FLCU01")
                .build();

        businessPartner.addBusinessPartnerRole(businessPartnerRole1);
        businessPartner.addBusinessPartnerRole(businessPartnerRole2);

        final AddressEmailAddress emailAddress = AddressEmailAddress.builder()
                .emailAddress(oxidBusinessPartner.getEmail())
                .build();

        for (PostalAddress address : oxidBusinessPartner.getPostalAddresses()) {
            final BusinessPartnerAddress businessPartnerAddress = BusinessPartnerAddress.builder()
                    .country(address.getCountry())
                    .cityName(address.getCity())
                    .postalCode(address.getZipCode())
                    .county(address.getRegion())
                    .emailAddress(emailAddress)
                    .build();

            businessPartner.addBusinessPartnerAddress(businessPartnerAddress);
        }

现在,我可以使用DefaultBusinessPartnerService. 然而,实际的深度插入似乎无法正常工作,因为Customer没有创建。

A_BusinessPartner我可以通过使用展开 to查询 API 来确认这一点to_Customer,它返回null. 然而,深插入BusinessPartnerRole按预期工作。

那么,我在这里缺少什么?是否存在某种依赖关系,例如我首先需要创建一个BusinessPartner然后是一个Customer(我绝不是 S4/HANA 方面的专家)?但话又说回来,SAP Cloud SDK 没有提供创建 a 的方法,Customerapi.sap.com 也没有。

4

2 回答 2

2

不幸的是,使用Business Partner API时无法创建Customer实体的实例。在官方文档中,您会发现仅支持“阅读”和“更新”客户。我在SAP API Business Hub中寻找替代的 Rest 服务,并找到了Customer Master 服务,但功能有限。也许它允许创建客户。

于 2019-09-02T15:24:01.517 回答
1

如果我让客户“空着”,那么如果我只是这样做 Customer customer = Customer.builder().build();并将其附加到业务合作伙伴,则会以某种方式创建客户实体。然后,我使用 OData Servives /A_CustomerCompany 和 /A_CustomerSalesArea 分别创建这些实体,一切都按预期工作。

于 2019-09-08T15:46:02.623 回答