通过 SAP Cloud SDK VDM 深入插入业务合作伙伴在 to_Customer 上不起作用

Deep Insert on Business Partner via SAP Cloud SDK VDM doesn't work on to_Customer

我正在尝试使用 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 API 并扩展到 to_Customer returns null 来确认这一点。 BusinessPartnerRole 上的深度插入按预期工作。

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

也没有。

遗憾的是,在使用 业务合作伙伴 API 时,无法创建 Customer 实体的实例。在 official documentation you will find only support for "Reading" and "Updating" Customers. I looked for an alternative Rest service in the SAP API Business Hub and found the Customer Master service 中,虽然功能有限。也许它允许创建客户。

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