使用S/4 Hana Cloud SDK和Cloud SDK创建父实体及其子实体

2020-09-10 14:02发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


如何使用S/4 Hana Cloud SDK和Cloud SDK创建父实体及其子实体,该如何解决以下错误?

 " errordetails":[

 {
 "代码":" API_PRD_MSG/004",
 " message":"为产品至少提供一个描述。",
 " propertyref":"",
 "严重程度":"错误",
 "目标":""
 }
 ]
 

如何修改我的代码?

更新

此深度创建博客[ https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud- 使用servlet 实现sdk为虚拟数据模型创建并深度插入用于odata/[1] (其中HttpRequestServlet类用于获取参数) 但是我正在使用Cloud SDK的@Create批注和CreateRequest类来获取有效负载。

能够在toParent对象中获取父实体数据产品toParent = new ModelMapper()。map(req.getMapData(),Product.class); < strong>如何获取要在有效负载中传递的实体数据(此处为ProductDescription)以深度插入父实体和子实体数据?

我在邮递员中传递的有效载荷:

  {
   "产品":"球",
     " ProductType":" ZHLB",
     " CrossPlantStatus":"",
     " CrossPlantStatusValidityDate":null,
     " CreationDate":" \/Date(1499731200000)\/",
     " CreatedByUser":" 11279380",
     " LastChangeDate":" \/日期(1550448000000)\/",
     " LastChangedByUser":" HWV87616",
     " IsMarkedForDeletion":否,
     " ProductOldID":"",
     "毛重":" 0.000",
     " PurchaseOrderQuantityUnit":"",
     " SourceOfSupply":"",
     " WeightUnit":" KG",
     " NetWeight":" 0.000",
     "出生国家" : "",
     " CompetitorID":"",
     " ProductGroup":" 01",
     " BaseUnit":" EA",
     " ItemCategoryGroup":"",
     " ProductHierarchy":"",
     " Division":"",
     " VarblPurOrdUnitIsActive":"",
     " VolumeUnit":"",
     " MaterialVolume":" 0.000",
     " ANPCode":" 0",
     "牌" :​​ "",
     " ProcurementRule":"",
     " ValidityStartDate":null,
     " LowLevelCode":"",
     " ProdNoInGenProdInPrepackProd":"",
     " SerialIdentifierAssgmtProfile":"",
     " SizeOrDimensionText":"",
     " IndustryStandardName":"",
     " ProductStandardID":"",
     " InternationalArticleNumberCat":"",
     " ProductIsConfigurable":否,
     " IsBatchManagementRequired":否,
     " ExternalProductGroup":"",
     " CrossPlantConfigurableProduct":"",
     " SerialNoExplicitnessLevel":"",
     " ManufacturerPartProfile":"",
     " ChangeNumber":"",
     " MaterialRevisionLevel":"",
     " HandlingIndicator":"",
     " WarehouseProductGroup":"",
     " WarehouseStorageCondition":"",
     " StandardHandlingUnitType":"",
     " SerialNumberProfile":"",
     " AdjustmentProfile":"",
     " PreferredUnitOfMeasure":"",
     " IsPilferable":false,
     " IsRelevantForHzdsSubstances":否,
     "隔离期":" 0",
     " TimeUnitForQuarantinePeriod":"",
     " QualityInspectionGroup":"",
     " AuthorizationGroup":"",
     " HandlingUnitType":"",
     " HasVariableTareWeight":false,
     " MaximumPackagingLength":" 0.000",
     " MaximumPackagingWidth":" 0.000",
     " MaximumPackagingHeight":" 0.000",
   " to_Description":{
     "结果":[
      {
         "产品":"球",
         " Language":" EN",
         " ProductDescription":"机器用管"
       }
     ]
   }
 }
 

创建正在使用的代码

  @Create(serviceName =" ProductService",Entity =" Products")
     公共CreateResponse create(CreateRequest req)引发ODataException {
     要创建的产品= new ModelMapper()。map(req.getMapData(),Product.class);
     创建的产品=新的DefaultProductMasterService()。createProduct(toCreate)
                     .execute(new ErpConfigContext(" K4XS4SDKDest"));
                 新的DefaultProductMasterService()。createProductDescription(toCreateDescription).asChildOf(toCreate,Product.TO_DESCRIPTION);
             返回CreateResponse.setSuccess()。setData(created).response();
 

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


如何使用S/4 Hana Cloud SDK和Cloud SDK创建父实体及其子实体,该如何解决以下错误?

 " errordetails":[

 {
 "代码":" API_PRD_MSG/004",
 " message":"为产品至少提供一个描述。",
 " propertyref":"",
 "严重程度":"错误",
 "目标":""
 }
 ]
 

如何修改我的代码?

更新

此深度创建博客[ https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud- 使用servlet 实现sdk为虚拟数据模型创建并深度插入用于odata/[1] (其中HttpRequestServlet类用于获取参数) 但是我正在使用Cloud SDK的@Create批注和CreateRequest类来获取有效负载。

能够在toParent对象中获取父实体数据产品toParent = new ModelMapper()。map(req.getMapData(),Product.class); < strong>如何获取要在有效负载中传递的实体数据(此处为ProductDescription)以深度插入父实体和子实体数据?

我在邮递员中传递的有效载荷:

  {
   "产品":"球",
     " ProductType":" ZHLB",
     " CrossPlantStatus":"",
     " CrossPlantStatusValidityDate":null,
     " CreationDate":" \/Date(1499731200000)\/",
     " CreatedByUser":" 11279380",
     " LastChangeDate":" \/日期(1550448000000)\/",
     " LastChangedByUser":" HWV87616",
     " IsMarkedForDeletion":否,
     " ProductOldID":"",
     "毛重":" 0.000",
     " PurchaseOrderQuantityUnit":"",
     " SourceOfSupply":"",
     " WeightUnit":" KG",
     " NetWeight":" 0.000",
     "出生国家" : "",
     " CompetitorID":"",
     " ProductGroup":" 01",
     " BaseUnit":" EA",
     " ItemCategoryGroup":"",
     " ProductHierarchy":"",
     " Division":"",
     " VarblPurOrdUnitIsActive":"",
     " VolumeUnit":"",
     " MaterialVolume":" 0.000",
     " ANPCode":" 0",
     "牌" :​​ "",
     " ProcurementRule":"",
     " ValidityStartDate":null,
     " LowLevelCode":"",
     " ProdNoInGenProdInPrepackProd":"",
     " SerialIdentifierAssgmtProfile":"",
     " SizeOrDimensionText":"",
     " IndustryStandardName":"",
     " ProductStandardID":"",
     " InternationalArticleNumberCat":"",
     " ProductIsConfigurable":否,
     " IsBatchManagementRequired":否,
     " ExternalProductGroup":"",
     " CrossPlantConfigurableProduct":"",
     " SerialNoExplicitnessLevel":"",
     " ManufacturerPartProfile":"",
     " ChangeNumber":"",
     " MaterialRevisionLevel":"",
     " HandlingIndicator":"",
     " WarehouseProductGroup":"",
     " WarehouseStorageCondition":"",
     " StandardHandlingUnitType":"",
     " SerialNumberProfile":"",
     " AdjustmentProfile":"",
     " PreferredUnitOfMeasure":"",
     " IsPilferable":false,
     " IsRelevantForHzdsSubstances":否,
     "隔离期":" 0",
     " TimeUnitForQuarantinePeriod":"",
     " QualityInspectionGroup":"",
     " AuthorizationGroup":"",
     " HandlingUnitType":"",
     " HasVariableTareWeight":false,
     " MaximumPackagingLength":" 0.000",
     " MaximumPackagingWidth":" 0.000",
     " MaximumPackagingHeight":" 0.000",
   " to_Description":{
     "结果":[
      {
         "产品":"球",
         " Language":" EN",
         " ProductDescription":"机器用管"
       }
     ]
   }
 }
 

创建正在使用的代码

  @Create(serviceName =" ProductService",Entity =" Products")
     公共CreateResponse create(CreateRequest req)引发ODataException {
     要创建的产品= new ModelMapper()。map(req.getMapData(),Product.class);
     创建的产品=新的DefaultProductMasterService()。createProduct(toCreate)
                     .execute(new ErpConfigContext(" K4XS4SDKDest"));
                 新的DefaultProductMasterService()。createProductDescription(toCreateDescription).asChildOf(toCreate,Product.TO_DESCRIPTION);
             返回CreateResponse.setSuccess()。setData(created).response();
 
付费偷看设置
发送
1条回答
SAP小黑
1楼 · 2020-09-10 14:58.采纳回答

你好Meenakshi,

感谢您与我们联系并报告此问题。

不幸的是,这不是SAP S/4HANA Cloud SDK本身的问题。 但是,我们已经让可以在此处提供帮助的同事意识到这一问题。

最好的问候

丹尼斯

一周热门 更多>