Not able to perform Deep Insert operation for API_PRODUCT_SRV Standard WhiteListed API using S/4 Hana Cloud SDKFailure connecting to S/4 Hana via Cloud SDK

How do I create uniquely male characters?

What is the word for reserving something for yourself before others do?

The Two and the One

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

The use of multiple foreign keys on same column in SQL Server

Why was the small council so happy for Tyrion to become the Master of Coin?

Is it important to consider tone, melody, and musical form while writing a song?

Have astronauts in space suits ever taken selfies? If so, how?

is the intersection of subgroups a subgroup of each subgroup

How to write a macro that is braces sensitive?

Today is the Center

Why doesn't H₄O²⁺ exist?

Modeling an IPv4 Address

In Japanese, what’s the difference between “Tonari ni” (となりに) and “Tsugi” (つぎ)? When would you use one over the other?

What do the dots in this tr command do: tr .............A-Z A-ZA-Z <<< "JVPQBOV" (with 13 dots)

Why don't electron-positron collisions release infinite energy?

Why can't I see bouncing of a switch on an oscilloscope?

TGV timetables / schedules?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

To string or not to string

Problem of parity - Can we draw a closed path made up of 20 line segments...

Languages that we cannot (dis)prove to be Context-Free

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

What is the offset in a seaplane's hull?



Not able to perform Deep Insert operation for API_PRODUCT_SRV Standard WhiteListed API using S/4 Hana Cloud SDK


Failure connecting to S/4 Hana via Cloud SDK






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have completed read and update operations on API_PRODUCT_SRV Service.



Now while doing deep insert on API_PRODUCT_SRV (Product Entity-which has many associations) I am getting the following error.



“errordetails”: [


“code”: “API_PRD_MSG/004”,
“message”: “Provide atleast one description for the product.”,
“propertyref”: “”,
“severity”: “error”,
“target”: “”

]


I found this deep dive blog



https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud-sdk-create-and-deep-insert-with-the-virtual-data-model-for-odata/comment-page-1/#comment-453020



which explains the deep insert using servlets.(i.e Using HttpServletReq) which provides the rest service.



But I am using the CreateRequest class from SAP Cloud Application Programming Model which generates odata service, so that I cannot use the similar code which is presented in the blog.



I have added the code and the payload for your perusal.



Create Operation code



@Create(serviceName = "ProductService", entity = "Products")
public CreateResponse create(CreateRequest req) throws ODataException
Product toCreate = new ModelMapper().map(req.getMapData(), Product.class);
Product created = new DefaultProductMasterService().createProduct(toCreate)
.execute(new ErpConfigContext("K4XS4SDKDest"));
return CreateResponse.setSuccess().setData(created).response();



Payload being used:




"Product" : "BALL",
"ProductType" : "ZHLB",
"CrossPlantStatus" : "",
"CrossPlantStatusValidityDate" : null,
"CreationDate" : "/Date(1499731200000)/",
"CreatedByUser" : "11279380",
"LastChangeDate" : "/Date(1550448000000)/",
"LastChangedByUser" : "HWV87616",
"IsMarkedForDeletion" : false,
"ProductOldID" : "",
"GrossWeight" : "0.000",
"PurchaseOrderQuantityUnit" : "",
"SourceOfSupply" : "",
"WeightUnit" : "KG",
"NetWeight" : "0.000",
"CountryOfOrigin" : "",
"CompetitorID" : "",
"ProductGroup" : "01",
"BaseUnit" : "EA",
"ItemCategoryGroup" : "",
"ProductHierarchy" : "",
"Division" : "",
"VarblPurOrdUnitIsActive" : "",
"VolumeUnit" : "",
"MaterialVolume" : "0.000",
"ANPCode" : "0",
"Brand" : "",
"ProcurementRule" : "",
"ValidityStartDate" : null,
"LowLevelCode" : "",
"ProdNoInGenProdInPrepackProd" : "",
"SerialIdentifierAssgmtProfile" : "",
"SizeOrDimensionText" : "",
"IndustryStandardName" : "",
"ProductStandardID" : "",
"InternationalArticleNumberCat" : "",
"ProductIsConfigurable" : false,
"IsBatchManagementRequired" : false,
"ExternalProductGroup" : "",
"CrossPlantConfigurableProduct" : "",
"SerialNoExplicitnessLevel" : "",
"ManufacturerPartProfile" : "",
"ChangeNumber" : "",
"MaterialRevisionLevel" : "",
"HandlingIndicator" : "",
"WarehouseProductGroup" : "",
"WarehouseStorageCondition" : "",
"StandardHandlingUnitType" : "",
"SerialNumberProfile" : "",
"AdjustmentProfile" : "",
"PreferredUnitOfMeasure" : "",
"IsPilferable" : false,
"IsRelevantForHzdsSubstances" : false,
"QuarantinePeriod" : "0",
"TimeUnitForQuarantinePeriod" : "",
"QualityInspectionGroup" : "",
"AuthorizationGroup" : "",
"HandlingUnitType" : "",
"HasVariableTareWeight" : false,
"MaximumPackagingLength" : "0.000",
"MaximumPackagingWidth" : "0.000",
"MaximumPackagingHeight" : "0.000",
"to_Description":
"results": [

"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"

]




Can u please help me how shall I modify my code to make deep insert with SAP S/4HANA Cloud SDK work while using SAP Cloud Application Programming Model (CreateRequest class)?



Log file:



Product(super=VdmObject(customFields=, changedOriginalFields=LowLevelCode=null, ProductGroup=null, SizeOrDimensionText=null, CreatedByUser=null, CountryOfOrigin=null, Product=null, ProductStandardID=null, IsPilferable=null, VolumeUnit=null, WarehouseProductGroup=null, WarehouseStorageCondition=null, MaterialVolume=null, ManufacturerPartProfile=null, CrossPlantStatus=null, TimeUnitForQuarantinePeriod=null, GrossWeight=null, InternationalArticleNumberCat=null, SourceOfSupply=null, ProductType=null, ItemCategoryGroup=null, ProcurementRule=null, BaseUnit=null, ProductOldID=null, VarblPurOrdUnitIsActive=null, LastChangedByUser=null, Brand=null, MaximumPackagingWidth=null, QuarantinePeriod=null, PurchaseOrderQuantityUnit=null, ProductHierarchy=null, AuthorizationGroup=null, StandardHandlingUnitType=null, MaterialRevisionLevel=null, ExternalProductGroup=null, CrossPlantConfigurableProduct=null, MaximumPackagingLength=null, HasVariableTareWeight=null, ANPCode=null, ProdNoInGenProdInPrepackProd=null, WeightUnit=null, IsMarkedForDeletion=null, CompetitorID=null, QualityInspectionGroup=null, IsBatchManagementRequired=null, IsRelevantForHzdsSubstances=null, Division=null, SerialIdentifierAssgmtProfile=null, AdjustmentProfile=null, PreferredUnitOfMeasure=null, SerialNoExplicitnessLevel=null, HandlingIndicator=null, HandlingUnitType=null, NetWeight=null, ProductIsConfigurable=null, IndustryStandardName=null, SerialNumberProfile=null, ChangeNumber=null, MaximumPackagingHeight=null), product=BELL, productType=ZHLB, crossPlantStatus=, crossPlantStatusValidityDate=null, creationDate=null, createdByUser=11279380, lastChangeDate=null, lastChangedByUser=HWV87616, lastChangeDateTime=null, isMarkedForDeletion=false, productOldID=, grossWeight=0.000, purchaseOrderQuantityUnit=, sourceOfSupply=, weightUnit=KG, netWeight=0.000, countryOfOrigin=, competitorID=, productGroup=01, baseUnit=EA, itemCategoryGroup=, productHierarchy=, division=, varblPurOrdUnitIsActive=, volumeUnit=, materialVolume=0.000, aNPCode=0, brand=, procurementRule=, validityStartDate=null, lowLevelCode=, prodNoInGenProdInPrepackProd=, serialIdentifierAssgmtProfile=, sizeOrDimensionText=, industryStandardName=, productStandardID=, internationalArticleNumberCat=, productIsConfigurable=false, isBatchManagementRequired=false, externalProductGroup=, crossPlantConfigurableProduct=, serialNoExplicitnessLevel=, productManufacturerNumber=null, manufacturerNumber=null, manufacturerPartProfile=, changeNumber=, materialRevisionLevel=, handlingIndicator=, warehouseProductGroup=, warehouseStorageCondition=, standardHandlingUnitType=, serialNumberProfile=, adjustmentProfile=, preferredUnitOfMeasure=, isPilferable=false, isRelevantForHzdsSubstances=false, quarantinePeriod=0, timeUnitForQuarantinePeriod=, qualityInspectionGroup=, authorizationGroup=, handlingUnitType=, hasVariableTareWeight=false, maximumPackagingLength=0.000, maximumPackagingWidth=0.000, maximumPackagingHeight=0.000, erpConfigContext=null, toDescription=null, toPlant=null, toProductBasicText=null, toProductInspectionText=null, toProductProcurement=null, toProductPurchaseText=null, toProductQualityMgmt=null, toProductSales=null, toProductSalesTax=null, toProductStorage=null, toProductUnitsOfMeasure=null, toSalesDelivery=null)
{ "written_at":"2019-03-11T03:56:27.923Z","written_ts":918343802814688,"component_id":"e8c99eff-1a4e-4266-ba2a-fc099399100c","component_name":"FNpy7mXtvln0dnT1-FinalTestApp-srv","DCComponent":"","organization_name":"-","component_type":"application","space_name":"dev","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"a78252bf-72bf-479c-b761-8260de0c776e","Application":"FNpy7mXtvln0dnT1-FinalTestApp-srv","container_id":"10.0.138.113","type":"log","logger":"com.sap.cloud.sdk.service.prov.api.util.ProcessorHelper","thread":"http-nio-0.0.0.0-3000-exec-7","level":"ERROR","categories":[],"msg":"The endpoint responded with HTTP error code 400.nProvide atleast one description for the product.nFull error message: nn "error": n "code": "API_PRD_MSG/004",n "message": n "lang": "en",n "value": "Provide atleast one description for the product."n ,n "innererror": n "application": n "component_id": "LO-MD-MM",n "service_namespace": "/SAP/",n "service_id": "API_PRODUCT_SRV",n "service_version": "0001"n ,n "transactionid": "C16DD240C7520010E005C7E648BC12F5",n "timestamp": "20190311035627.5989630",n "Error_Resolution": n "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",n "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"n ,n "errordetails": [n n "code": "API_PRD_MSG/004",n "message": "Provide atleast one description for the product.",n "propertyref": "",n "severity": "error",n "target": ""n n ]n n n","stacktrace":["java.lang.reflect.InvocationTargetException","tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","tat


my-service.cds



 using API_PRODUCT_SRV from '../srv/external/csn/API_PRODUCT_SRV.json';
service ProductService

entity Products as Projection on API_PRODUCT_SRV.A_ProductType
key Product,
ProductType,
CreationDate,
CrossPlantStatus,
CrossPlantStatusValidityDate,
CreatedByUser,
LastChangeDate,
LastChangedByUser,
IsMarkedForDeletion,
ProductOldID,
GrossWeight,
PurchaseOrderQuantityUnit,
SourceOfSupply,
WeightUnit,
NetWeight,
CountryOfOrigin,
CompetitorID,
ProductGroup,
BaseUnit,
ItemCategoryGroup,
ProductHierarchy,
Division,
VarblPurOrdUnitIsActive,
VolumeUnit,
MaterialVolume,
ANPCode,
Brand,
ProcurementRule,
ValidityStartDate,
LowLevelCode,
ProdNoInGenProdInPrepackProd,
SerialIdentifierAssgmtProfile,
SizeOrDimensionText,
IndustryStandardName,
ProductStandardID,
InternationalArticleNumberCat,
ProductIsConfigurable,
IsBatchManagementRequired,
ExternalProductGroup,
CrossPlantConfigurableProduct,
SerialNoExplicitnessLevel,
ProductManufacturerNumber,
ManufacturerPartProfile,
ChangeNumber,
MaterialRevisionLevel,
HandlingIndicator,
WarehouseProductGroup,
WarehouseStorageCondition,
StandardHandlingUnitType,
SerialNumberProfile,
AdjustmentProfile,
PreferredUnitOfMeasure,
IsPilferable,
IsRelevantForHzdsSubstances,
QuarantinePeriod,
TimeUnitForQuarantinePeriod,
QualityInspectionGroup,
AuthorizationGroup,
HandlingUnitType,
HasVariableTareWeight,
MaximumPackagingLength,
MaximumPackagingWidth,
MaximumPackagingHeight,
to_Description

entity A_ProductDescriptionType as Projection on API_PRODUCT_SRV.A_ProductDescriptionType

key Product,
key Language,
ProductDescription




Can u please tell how to add associations in it?
my-service.cds



using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER';

service CrudService

@cds.persistence.skip
Entity BusinessPartner as projection on bp.A_BusinessPartnerType
BusinessPartner,
LastName,
FirstName,
BusinessPartnerCategory
;



Warm regards,



Meenakshi










share|improve this question
























  • Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

    – Henning Heitkötter
    Mar 8 at 7:35











  • Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

    – Meenakshi
    Mar 11 at 4:12












  • Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

    – Meenakshi
    Mar 11 at 7:50











  • Can you also print the content of req.getMapData()? Does it contain the payload you expect?

    – Henning Heitkötter
    Mar 11 at 16:37











  • No it is not giving the right payload..It is only getting product entity data and not the product description data.

    – Meenakshi
    Mar 12 at 4:18


















0















I have completed read and update operations on API_PRODUCT_SRV Service.



Now while doing deep insert on API_PRODUCT_SRV (Product Entity-which has many associations) I am getting the following error.



“errordetails”: [


“code”: “API_PRD_MSG/004”,
“message”: “Provide atleast one description for the product.”,
“propertyref”: “”,
“severity”: “error”,
“target”: “”

]


I found this deep dive blog



https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud-sdk-create-and-deep-insert-with-the-virtual-data-model-for-odata/comment-page-1/#comment-453020



which explains the deep insert using servlets.(i.e Using HttpServletReq) which provides the rest service.



But I am using the CreateRequest class from SAP Cloud Application Programming Model which generates odata service, so that I cannot use the similar code which is presented in the blog.



I have added the code and the payload for your perusal.



Create Operation code



@Create(serviceName = "ProductService", entity = "Products")
public CreateResponse create(CreateRequest req) throws ODataException
Product toCreate = new ModelMapper().map(req.getMapData(), Product.class);
Product created = new DefaultProductMasterService().createProduct(toCreate)
.execute(new ErpConfigContext("K4XS4SDKDest"));
return CreateResponse.setSuccess().setData(created).response();



Payload being used:




"Product" : "BALL",
"ProductType" : "ZHLB",
"CrossPlantStatus" : "",
"CrossPlantStatusValidityDate" : null,
"CreationDate" : "/Date(1499731200000)/",
"CreatedByUser" : "11279380",
"LastChangeDate" : "/Date(1550448000000)/",
"LastChangedByUser" : "HWV87616",
"IsMarkedForDeletion" : false,
"ProductOldID" : "",
"GrossWeight" : "0.000",
"PurchaseOrderQuantityUnit" : "",
"SourceOfSupply" : "",
"WeightUnit" : "KG",
"NetWeight" : "0.000",
"CountryOfOrigin" : "",
"CompetitorID" : "",
"ProductGroup" : "01",
"BaseUnit" : "EA",
"ItemCategoryGroup" : "",
"ProductHierarchy" : "",
"Division" : "",
"VarblPurOrdUnitIsActive" : "",
"VolumeUnit" : "",
"MaterialVolume" : "0.000",
"ANPCode" : "0",
"Brand" : "",
"ProcurementRule" : "",
"ValidityStartDate" : null,
"LowLevelCode" : "",
"ProdNoInGenProdInPrepackProd" : "",
"SerialIdentifierAssgmtProfile" : "",
"SizeOrDimensionText" : "",
"IndustryStandardName" : "",
"ProductStandardID" : "",
"InternationalArticleNumberCat" : "",
"ProductIsConfigurable" : false,
"IsBatchManagementRequired" : false,
"ExternalProductGroup" : "",
"CrossPlantConfigurableProduct" : "",
"SerialNoExplicitnessLevel" : "",
"ManufacturerPartProfile" : "",
"ChangeNumber" : "",
"MaterialRevisionLevel" : "",
"HandlingIndicator" : "",
"WarehouseProductGroup" : "",
"WarehouseStorageCondition" : "",
"StandardHandlingUnitType" : "",
"SerialNumberProfile" : "",
"AdjustmentProfile" : "",
"PreferredUnitOfMeasure" : "",
"IsPilferable" : false,
"IsRelevantForHzdsSubstances" : false,
"QuarantinePeriod" : "0",
"TimeUnitForQuarantinePeriod" : "",
"QualityInspectionGroup" : "",
"AuthorizationGroup" : "",
"HandlingUnitType" : "",
"HasVariableTareWeight" : false,
"MaximumPackagingLength" : "0.000",
"MaximumPackagingWidth" : "0.000",
"MaximumPackagingHeight" : "0.000",
"to_Description":
"results": [

"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"

]




Can u please help me how shall I modify my code to make deep insert with SAP S/4HANA Cloud SDK work while using SAP Cloud Application Programming Model (CreateRequest class)?



Log file:



Product(super=VdmObject(customFields=, changedOriginalFields=LowLevelCode=null, ProductGroup=null, SizeOrDimensionText=null, CreatedByUser=null, CountryOfOrigin=null, Product=null, ProductStandardID=null, IsPilferable=null, VolumeUnit=null, WarehouseProductGroup=null, WarehouseStorageCondition=null, MaterialVolume=null, ManufacturerPartProfile=null, CrossPlantStatus=null, TimeUnitForQuarantinePeriod=null, GrossWeight=null, InternationalArticleNumberCat=null, SourceOfSupply=null, ProductType=null, ItemCategoryGroup=null, ProcurementRule=null, BaseUnit=null, ProductOldID=null, VarblPurOrdUnitIsActive=null, LastChangedByUser=null, Brand=null, MaximumPackagingWidth=null, QuarantinePeriod=null, PurchaseOrderQuantityUnit=null, ProductHierarchy=null, AuthorizationGroup=null, StandardHandlingUnitType=null, MaterialRevisionLevel=null, ExternalProductGroup=null, CrossPlantConfigurableProduct=null, MaximumPackagingLength=null, HasVariableTareWeight=null, ANPCode=null, ProdNoInGenProdInPrepackProd=null, WeightUnit=null, IsMarkedForDeletion=null, CompetitorID=null, QualityInspectionGroup=null, IsBatchManagementRequired=null, IsRelevantForHzdsSubstances=null, Division=null, SerialIdentifierAssgmtProfile=null, AdjustmentProfile=null, PreferredUnitOfMeasure=null, SerialNoExplicitnessLevel=null, HandlingIndicator=null, HandlingUnitType=null, NetWeight=null, ProductIsConfigurable=null, IndustryStandardName=null, SerialNumberProfile=null, ChangeNumber=null, MaximumPackagingHeight=null), product=BELL, productType=ZHLB, crossPlantStatus=, crossPlantStatusValidityDate=null, creationDate=null, createdByUser=11279380, lastChangeDate=null, lastChangedByUser=HWV87616, lastChangeDateTime=null, isMarkedForDeletion=false, productOldID=, grossWeight=0.000, purchaseOrderQuantityUnit=, sourceOfSupply=, weightUnit=KG, netWeight=0.000, countryOfOrigin=, competitorID=, productGroup=01, baseUnit=EA, itemCategoryGroup=, productHierarchy=, division=, varblPurOrdUnitIsActive=, volumeUnit=, materialVolume=0.000, aNPCode=0, brand=, procurementRule=, validityStartDate=null, lowLevelCode=, prodNoInGenProdInPrepackProd=, serialIdentifierAssgmtProfile=, sizeOrDimensionText=, industryStandardName=, productStandardID=, internationalArticleNumberCat=, productIsConfigurable=false, isBatchManagementRequired=false, externalProductGroup=, crossPlantConfigurableProduct=, serialNoExplicitnessLevel=, productManufacturerNumber=null, manufacturerNumber=null, manufacturerPartProfile=, changeNumber=, materialRevisionLevel=, handlingIndicator=, warehouseProductGroup=, warehouseStorageCondition=, standardHandlingUnitType=, serialNumberProfile=, adjustmentProfile=, preferredUnitOfMeasure=, isPilferable=false, isRelevantForHzdsSubstances=false, quarantinePeriod=0, timeUnitForQuarantinePeriod=, qualityInspectionGroup=, authorizationGroup=, handlingUnitType=, hasVariableTareWeight=false, maximumPackagingLength=0.000, maximumPackagingWidth=0.000, maximumPackagingHeight=0.000, erpConfigContext=null, toDescription=null, toPlant=null, toProductBasicText=null, toProductInspectionText=null, toProductProcurement=null, toProductPurchaseText=null, toProductQualityMgmt=null, toProductSales=null, toProductSalesTax=null, toProductStorage=null, toProductUnitsOfMeasure=null, toSalesDelivery=null)
{ "written_at":"2019-03-11T03:56:27.923Z","written_ts":918343802814688,"component_id":"e8c99eff-1a4e-4266-ba2a-fc099399100c","component_name":"FNpy7mXtvln0dnT1-FinalTestApp-srv","DCComponent":"","organization_name":"-","component_type":"application","space_name":"dev","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"a78252bf-72bf-479c-b761-8260de0c776e","Application":"FNpy7mXtvln0dnT1-FinalTestApp-srv","container_id":"10.0.138.113","type":"log","logger":"com.sap.cloud.sdk.service.prov.api.util.ProcessorHelper","thread":"http-nio-0.0.0.0-3000-exec-7","level":"ERROR","categories":[],"msg":"The endpoint responded with HTTP error code 400.nProvide atleast one description for the product.nFull error message: nn "error": n "code": "API_PRD_MSG/004",n "message": n "lang": "en",n "value": "Provide atleast one description for the product."n ,n "innererror": n "application": n "component_id": "LO-MD-MM",n "service_namespace": "/SAP/",n "service_id": "API_PRODUCT_SRV",n "service_version": "0001"n ,n "transactionid": "C16DD240C7520010E005C7E648BC12F5",n "timestamp": "20190311035627.5989630",n "Error_Resolution": n "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",n "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"n ,n "errordetails": [n n "code": "API_PRD_MSG/004",n "message": "Provide atleast one description for the product.",n "propertyref": "",n "severity": "error",n "target": ""n n ]n n n","stacktrace":["java.lang.reflect.InvocationTargetException","tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","tat


my-service.cds



 using API_PRODUCT_SRV from '../srv/external/csn/API_PRODUCT_SRV.json';
service ProductService

entity Products as Projection on API_PRODUCT_SRV.A_ProductType
key Product,
ProductType,
CreationDate,
CrossPlantStatus,
CrossPlantStatusValidityDate,
CreatedByUser,
LastChangeDate,
LastChangedByUser,
IsMarkedForDeletion,
ProductOldID,
GrossWeight,
PurchaseOrderQuantityUnit,
SourceOfSupply,
WeightUnit,
NetWeight,
CountryOfOrigin,
CompetitorID,
ProductGroup,
BaseUnit,
ItemCategoryGroup,
ProductHierarchy,
Division,
VarblPurOrdUnitIsActive,
VolumeUnit,
MaterialVolume,
ANPCode,
Brand,
ProcurementRule,
ValidityStartDate,
LowLevelCode,
ProdNoInGenProdInPrepackProd,
SerialIdentifierAssgmtProfile,
SizeOrDimensionText,
IndustryStandardName,
ProductStandardID,
InternationalArticleNumberCat,
ProductIsConfigurable,
IsBatchManagementRequired,
ExternalProductGroup,
CrossPlantConfigurableProduct,
SerialNoExplicitnessLevel,
ProductManufacturerNumber,
ManufacturerPartProfile,
ChangeNumber,
MaterialRevisionLevel,
HandlingIndicator,
WarehouseProductGroup,
WarehouseStorageCondition,
StandardHandlingUnitType,
SerialNumberProfile,
AdjustmentProfile,
PreferredUnitOfMeasure,
IsPilferable,
IsRelevantForHzdsSubstances,
QuarantinePeriod,
TimeUnitForQuarantinePeriod,
QualityInspectionGroup,
AuthorizationGroup,
HandlingUnitType,
HasVariableTareWeight,
MaximumPackagingLength,
MaximumPackagingWidth,
MaximumPackagingHeight,
to_Description

entity A_ProductDescriptionType as Projection on API_PRODUCT_SRV.A_ProductDescriptionType

key Product,
key Language,
ProductDescription




Can u please tell how to add associations in it?
my-service.cds



using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER';

service CrudService

@cds.persistence.skip
Entity BusinessPartner as projection on bp.A_BusinessPartnerType
BusinessPartner,
LastName,
FirstName,
BusinessPartnerCategory
;



Warm regards,



Meenakshi










share|improve this question
























  • Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

    – Henning Heitkötter
    Mar 8 at 7:35











  • Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

    – Meenakshi
    Mar 11 at 4:12












  • Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

    – Meenakshi
    Mar 11 at 7:50











  • Can you also print the content of req.getMapData()? Does it contain the payload you expect?

    – Henning Heitkötter
    Mar 11 at 16:37











  • No it is not giving the right payload..It is only getting product entity data and not the product description data.

    – Meenakshi
    Mar 12 at 4:18














0












0








0








I have completed read and update operations on API_PRODUCT_SRV Service.



Now while doing deep insert on API_PRODUCT_SRV (Product Entity-which has many associations) I am getting the following error.



“errordetails”: [


“code”: “API_PRD_MSG/004”,
“message”: “Provide atleast one description for the product.”,
“propertyref”: “”,
“severity”: “error”,
“target”: “”

]


I found this deep dive blog



https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud-sdk-create-and-deep-insert-with-the-virtual-data-model-for-odata/comment-page-1/#comment-453020



which explains the deep insert using servlets.(i.e Using HttpServletReq) which provides the rest service.



But I am using the CreateRequest class from SAP Cloud Application Programming Model which generates odata service, so that I cannot use the similar code which is presented in the blog.



I have added the code and the payload for your perusal.



Create Operation code



@Create(serviceName = "ProductService", entity = "Products")
public CreateResponse create(CreateRequest req) throws ODataException
Product toCreate = new ModelMapper().map(req.getMapData(), Product.class);
Product created = new DefaultProductMasterService().createProduct(toCreate)
.execute(new ErpConfigContext("K4XS4SDKDest"));
return CreateResponse.setSuccess().setData(created).response();



Payload being used:




"Product" : "BALL",
"ProductType" : "ZHLB",
"CrossPlantStatus" : "",
"CrossPlantStatusValidityDate" : null,
"CreationDate" : "/Date(1499731200000)/",
"CreatedByUser" : "11279380",
"LastChangeDate" : "/Date(1550448000000)/",
"LastChangedByUser" : "HWV87616",
"IsMarkedForDeletion" : false,
"ProductOldID" : "",
"GrossWeight" : "0.000",
"PurchaseOrderQuantityUnit" : "",
"SourceOfSupply" : "",
"WeightUnit" : "KG",
"NetWeight" : "0.000",
"CountryOfOrigin" : "",
"CompetitorID" : "",
"ProductGroup" : "01",
"BaseUnit" : "EA",
"ItemCategoryGroup" : "",
"ProductHierarchy" : "",
"Division" : "",
"VarblPurOrdUnitIsActive" : "",
"VolumeUnit" : "",
"MaterialVolume" : "0.000",
"ANPCode" : "0",
"Brand" : "",
"ProcurementRule" : "",
"ValidityStartDate" : null,
"LowLevelCode" : "",
"ProdNoInGenProdInPrepackProd" : "",
"SerialIdentifierAssgmtProfile" : "",
"SizeOrDimensionText" : "",
"IndustryStandardName" : "",
"ProductStandardID" : "",
"InternationalArticleNumberCat" : "",
"ProductIsConfigurable" : false,
"IsBatchManagementRequired" : false,
"ExternalProductGroup" : "",
"CrossPlantConfigurableProduct" : "",
"SerialNoExplicitnessLevel" : "",
"ManufacturerPartProfile" : "",
"ChangeNumber" : "",
"MaterialRevisionLevel" : "",
"HandlingIndicator" : "",
"WarehouseProductGroup" : "",
"WarehouseStorageCondition" : "",
"StandardHandlingUnitType" : "",
"SerialNumberProfile" : "",
"AdjustmentProfile" : "",
"PreferredUnitOfMeasure" : "",
"IsPilferable" : false,
"IsRelevantForHzdsSubstances" : false,
"QuarantinePeriod" : "0",
"TimeUnitForQuarantinePeriod" : "",
"QualityInspectionGroup" : "",
"AuthorizationGroup" : "",
"HandlingUnitType" : "",
"HasVariableTareWeight" : false,
"MaximumPackagingLength" : "0.000",
"MaximumPackagingWidth" : "0.000",
"MaximumPackagingHeight" : "0.000",
"to_Description":
"results": [

"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"

]




Can u please help me how shall I modify my code to make deep insert with SAP S/4HANA Cloud SDK work while using SAP Cloud Application Programming Model (CreateRequest class)?



Log file:



Product(super=VdmObject(customFields=, changedOriginalFields=LowLevelCode=null, ProductGroup=null, SizeOrDimensionText=null, CreatedByUser=null, CountryOfOrigin=null, Product=null, ProductStandardID=null, IsPilferable=null, VolumeUnit=null, WarehouseProductGroup=null, WarehouseStorageCondition=null, MaterialVolume=null, ManufacturerPartProfile=null, CrossPlantStatus=null, TimeUnitForQuarantinePeriod=null, GrossWeight=null, InternationalArticleNumberCat=null, SourceOfSupply=null, ProductType=null, ItemCategoryGroup=null, ProcurementRule=null, BaseUnit=null, ProductOldID=null, VarblPurOrdUnitIsActive=null, LastChangedByUser=null, Brand=null, MaximumPackagingWidth=null, QuarantinePeriod=null, PurchaseOrderQuantityUnit=null, ProductHierarchy=null, AuthorizationGroup=null, StandardHandlingUnitType=null, MaterialRevisionLevel=null, ExternalProductGroup=null, CrossPlantConfigurableProduct=null, MaximumPackagingLength=null, HasVariableTareWeight=null, ANPCode=null, ProdNoInGenProdInPrepackProd=null, WeightUnit=null, IsMarkedForDeletion=null, CompetitorID=null, QualityInspectionGroup=null, IsBatchManagementRequired=null, IsRelevantForHzdsSubstances=null, Division=null, SerialIdentifierAssgmtProfile=null, AdjustmentProfile=null, PreferredUnitOfMeasure=null, SerialNoExplicitnessLevel=null, HandlingIndicator=null, HandlingUnitType=null, NetWeight=null, ProductIsConfigurable=null, IndustryStandardName=null, SerialNumberProfile=null, ChangeNumber=null, MaximumPackagingHeight=null), product=BELL, productType=ZHLB, crossPlantStatus=, crossPlantStatusValidityDate=null, creationDate=null, createdByUser=11279380, lastChangeDate=null, lastChangedByUser=HWV87616, lastChangeDateTime=null, isMarkedForDeletion=false, productOldID=, grossWeight=0.000, purchaseOrderQuantityUnit=, sourceOfSupply=, weightUnit=KG, netWeight=0.000, countryOfOrigin=, competitorID=, productGroup=01, baseUnit=EA, itemCategoryGroup=, productHierarchy=, division=, varblPurOrdUnitIsActive=, volumeUnit=, materialVolume=0.000, aNPCode=0, brand=, procurementRule=, validityStartDate=null, lowLevelCode=, prodNoInGenProdInPrepackProd=, serialIdentifierAssgmtProfile=, sizeOrDimensionText=, industryStandardName=, productStandardID=, internationalArticleNumberCat=, productIsConfigurable=false, isBatchManagementRequired=false, externalProductGroup=, crossPlantConfigurableProduct=, serialNoExplicitnessLevel=, productManufacturerNumber=null, manufacturerNumber=null, manufacturerPartProfile=, changeNumber=, materialRevisionLevel=, handlingIndicator=, warehouseProductGroup=, warehouseStorageCondition=, standardHandlingUnitType=, serialNumberProfile=, adjustmentProfile=, preferredUnitOfMeasure=, isPilferable=false, isRelevantForHzdsSubstances=false, quarantinePeriod=0, timeUnitForQuarantinePeriod=, qualityInspectionGroup=, authorizationGroup=, handlingUnitType=, hasVariableTareWeight=false, maximumPackagingLength=0.000, maximumPackagingWidth=0.000, maximumPackagingHeight=0.000, erpConfigContext=null, toDescription=null, toPlant=null, toProductBasicText=null, toProductInspectionText=null, toProductProcurement=null, toProductPurchaseText=null, toProductQualityMgmt=null, toProductSales=null, toProductSalesTax=null, toProductStorage=null, toProductUnitsOfMeasure=null, toSalesDelivery=null)
{ "written_at":"2019-03-11T03:56:27.923Z","written_ts":918343802814688,"component_id":"e8c99eff-1a4e-4266-ba2a-fc099399100c","component_name":"FNpy7mXtvln0dnT1-FinalTestApp-srv","DCComponent":"","organization_name":"-","component_type":"application","space_name":"dev","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"a78252bf-72bf-479c-b761-8260de0c776e","Application":"FNpy7mXtvln0dnT1-FinalTestApp-srv","container_id":"10.0.138.113","type":"log","logger":"com.sap.cloud.sdk.service.prov.api.util.ProcessorHelper","thread":"http-nio-0.0.0.0-3000-exec-7","level":"ERROR","categories":[],"msg":"The endpoint responded with HTTP error code 400.nProvide atleast one description for the product.nFull error message: nn "error": n "code": "API_PRD_MSG/004",n "message": n "lang": "en",n "value": "Provide atleast one description for the product."n ,n "innererror": n "application": n "component_id": "LO-MD-MM",n "service_namespace": "/SAP/",n "service_id": "API_PRODUCT_SRV",n "service_version": "0001"n ,n "transactionid": "C16DD240C7520010E005C7E648BC12F5",n "timestamp": "20190311035627.5989630",n "Error_Resolution": n "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",n "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"n ,n "errordetails": [n n "code": "API_PRD_MSG/004",n "message": "Provide atleast one description for the product.",n "propertyref": "",n "severity": "error",n "target": ""n n ]n n n","stacktrace":["java.lang.reflect.InvocationTargetException","tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","tat


my-service.cds



 using API_PRODUCT_SRV from '../srv/external/csn/API_PRODUCT_SRV.json';
service ProductService

entity Products as Projection on API_PRODUCT_SRV.A_ProductType
key Product,
ProductType,
CreationDate,
CrossPlantStatus,
CrossPlantStatusValidityDate,
CreatedByUser,
LastChangeDate,
LastChangedByUser,
IsMarkedForDeletion,
ProductOldID,
GrossWeight,
PurchaseOrderQuantityUnit,
SourceOfSupply,
WeightUnit,
NetWeight,
CountryOfOrigin,
CompetitorID,
ProductGroup,
BaseUnit,
ItemCategoryGroup,
ProductHierarchy,
Division,
VarblPurOrdUnitIsActive,
VolumeUnit,
MaterialVolume,
ANPCode,
Brand,
ProcurementRule,
ValidityStartDate,
LowLevelCode,
ProdNoInGenProdInPrepackProd,
SerialIdentifierAssgmtProfile,
SizeOrDimensionText,
IndustryStandardName,
ProductStandardID,
InternationalArticleNumberCat,
ProductIsConfigurable,
IsBatchManagementRequired,
ExternalProductGroup,
CrossPlantConfigurableProduct,
SerialNoExplicitnessLevel,
ProductManufacturerNumber,
ManufacturerPartProfile,
ChangeNumber,
MaterialRevisionLevel,
HandlingIndicator,
WarehouseProductGroup,
WarehouseStorageCondition,
StandardHandlingUnitType,
SerialNumberProfile,
AdjustmentProfile,
PreferredUnitOfMeasure,
IsPilferable,
IsRelevantForHzdsSubstances,
QuarantinePeriod,
TimeUnitForQuarantinePeriod,
QualityInspectionGroup,
AuthorizationGroup,
HandlingUnitType,
HasVariableTareWeight,
MaximumPackagingLength,
MaximumPackagingWidth,
MaximumPackagingHeight,
to_Description

entity A_ProductDescriptionType as Projection on API_PRODUCT_SRV.A_ProductDescriptionType

key Product,
key Language,
ProductDescription




Can u please tell how to add associations in it?
my-service.cds



using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER';

service CrudService

@cds.persistence.skip
Entity BusinessPartner as projection on bp.A_BusinessPartnerType
BusinessPartner,
LastName,
FirstName,
BusinessPartnerCategory
;



Warm regards,



Meenakshi










share|improve this question
















I have completed read and update operations on API_PRODUCT_SRV Service.



Now while doing deep insert on API_PRODUCT_SRV (Product Entity-which has many associations) I am getting the following error.



“errordetails”: [


“code”: “API_PRD_MSG/004”,
“message”: “Provide atleast one description for the product.”,
“propertyref”: “”,
“severity”: “error”,
“target”: “”

]


I found this deep dive blog



https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud-sdk-create-and-deep-insert-with-the-virtual-data-model-for-odata/comment-page-1/#comment-453020



which explains the deep insert using servlets.(i.e Using HttpServletReq) which provides the rest service.



But I am using the CreateRequest class from SAP Cloud Application Programming Model which generates odata service, so that I cannot use the similar code which is presented in the blog.



I have added the code and the payload for your perusal.



Create Operation code



@Create(serviceName = "ProductService", entity = "Products")
public CreateResponse create(CreateRequest req) throws ODataException
Product toCreate = new ModelMapper().map(req.getMapData(), Product.class);
Product created = new DefaultProductMasterService().createProduct(toCreate)
.execute(new ErpConfigContext("K4XS4SDKDest"));
return CreateResponse.setSuccess().setData(created).response();



Payload being used:




"Product" : "BALL",
"ProductType" : "ZHLB",
"CrossPlantStatus" : "",
"CrossPlantStatusValidityDate" : null,
"CreationDate" : "/Date(1499731200000)/",
"CreatedByUser" : "11279380",
"LastChangeDate" : "/Date(1550448000000)/",
"LastChangedByUser" : "HWV87616",
"IsMarkedForDeletion" : false,
"ProductOldID" : "",
"GrossWeight" : "0.000",
"PurchaseOrderQuantityUnit" : "",
"SourceOfSupply" : "",
"WeightUnit" : "KG",
"NetWeight" : "0.000",
"CountryOfOrigin" : "",
"CompetitorID" : "",
"ProductGroup" : "01",
"BaseUnit" : "EA",
"ItemCategoryGroup" : "",
"ProductHierarchy" : "",
"Division" : "",
"VarblPurOrdUnitIsActive" : "",
"VolumeUnit" : "",
"MaterialVolume" : "0.000",
"ANPCode" : "0",
"Brand" : "",
"ProcurementRule" : "",
"ValidityStartDate" : null,
"LowLevelCode" : "",
"ProdNoInGenProdInPrepackProd" : "",
"SerialIdentifierAssgmtProfile" : "",
"SizeOrDimensionText" : "",
"IndustryStandardName" : "",
"ProductStandardID" : "",
"InternationalArticleNumberCat" : "",
"ProductIsConfigurable" : false,
"IsBatchManagementRequired" : false,
"ExternalProductGroup" : "",
"CrossPlantConfigurableProduct" : "",
"SerialNoExplicitnessLevel" : "",
"ManufacturerPartProfile" : "",
"ChangeNumber" : "",
"MaterialRevisionLevel" : "",
"HandlingIndicator" : "",
"WarehouseProductGroup" : "",
"WarehouseStorageCondition" : "",
"StandardHandlingUnitType" : "",
"SerialNumberProfile" : "",
"AdjustmentProfile" : "",
"PreferredUnitOfMeasure" : "",
"IsPilferable" : false,
"IsRelevantForHzdsSubstances" : false,
"QuarantinePeriod" : "0",
"TimeUnitForQuarantinePeriod" : "",
"QualityInspectionGroup" : "",
"AuthorizationGroup" : "",
"HandlingUnitType" : "",
"HasVariableTareWeight" : false,
"MaximumPackagingLength" : "0.000",
"MaximumPackagingWidth" : "0.000",
"MaximumPackagingHeight" : "0.000",
"to_Description":
"results": [

"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"

]




Can u please help me how shall I modify my code to make deep insert with SAP S/4HANA Cloud SDK work while using SAP Cloud Application Programming Model (CreateRequest class)?



Log file:



Product(super=VdmObject(customFields=, changedOriginalFields=LowLevelCode=null, ProductGroup=null, SizeOrDimensionText=null, CreatedByUser=null, CountryOfOrigin=null, Product=null, ProductStandardID=null, IsPilferable=null, VolumeUnit=null, WarehouseProductGroup=null, WarehouseStorageCondition=null, MaterialVolume=null, ManufacturerPartProfile=null, CrossPlantStatus=null, TimeUnitForQuarantinePeriod=null, GrossWeight=null, InternationalArticleNumberCat=null, SourceOfSupply=null, ProductType=null, ItemCategoryGroup=null, ProcurementRule=null, BaseUnit=null, ProductOldID=null, VarblPurOrdUnitIsActive=null, LastChangedByUser=null, Brand=null, MaximumPackagingWidth=null, QuarantinePeriod=null, PurchaseOrderQuantityUnit=null, ProductHierarchy=null, AuthorizationGroup=null, StandardHandlingUnitType=null, MaterialRevisionLevel=null, ExternalProductGroup=null, CrossPlantConfigurableProduct=null, MaximumPackagingLength=null, HasVariableTareWeight=null, ANPCode=null, ProdNoInGenProdInPrepackProd=null, WeightUnit=null, IsMarkedForDeletion=null, CompetitorID=null, QualityInspectionGroup=null, IsBatchManagementRequired=null, IsRelevantForHzdsSubstances=null, Division=null, SerialIdentifierAssgmtProfile=null, AdjustmentProfile=null, PreferredUnitOfMeasure=null, SerialNoExplicitnessLevel=null, HandlingIndicator=null, HandlingUnitType=null, NetWeight=null, ProductIsConfigurable=null, IndustryStandardName=null, SerialNumberProfile=null, ChangeNumber=null, MaximumPackagingHeight=null), product=BELL, productType=ZHLB, crossPlantStatus=, crossPlantStatusValidityDate=null, creationDate=null, createdByUser=11279380, lastChangeDate=null, lastChangedByUser=HWV87616, lastChangeDateTime=null, isMarkedForDeletion=false, productOldID=, grossWeight=0.000, purchaseOrderQuantityUnit=, sourceOfSupply=, weightUnit=KG, netWeight=0.000, countryOfOrigin=, competitorID=, productGroup=01, baseUnit=EA, itemCategoryGroup=, productHierarchy=, division=, varblPurOrdUnitIsActive=, volumeUnit=, materialVolume=0.000, aNPCode=0, brand=, procurementRule=, validityStartDate=null, lowLevelCode=, prodNoInGenProdInPrepackProd=, serialIdentifierAssgmtProfile=, sizeOrDimensionText=, industryStandardName=, productStandardID=, internationalArticleNumberCat=, productIsConfigurable=false, isBatchManagementRequired=false, externalProductGroup=, crossPlantConfigurableProduct=, serialNoExplicitnessLevel=, productManufacturerNumber=null, manufacturerNumber=null, manufacturerPartProfile=, changeNumber=, materialRevisionLevel=, handlingIndicator=, warehouseProductGroup=, warehouseStorageCondition=, standardHandlingUnitType=, serialNumberProfile=, adjustmentProfile=, preferredUnitOfMeasure=, isPilferable=false, isRelevantForHzdsSubstances=false, quarantinePeriod=0, timeUnitForQuarantinePeriod=, qualityInspectionGroup=, authorizationGroup=, handlingUnitType=, hasVariableTareWeight=false, maximumPackagingLength=0.000, maximumPackagingWidth=0.000, maximumPackagingHeight=0.000, erpConfigContext=null, toDescription=null, toPlant=null, toProductBasicText=null, toProductInspectionText=null, toProductProcurement=null, toProductPurchaseText=null, toProductQualityMgmt=null, toProductSales=null, toProductSalesTax=null, toProductStorage=null, toProductUnitsOfMeasure=null, toSalesDelivery=null)
{ "written_at":"2019-03-11T03:56:27.923Z","written_ts":918343802814688,"component_id":"e8c99eff-1a4e-4266-ba2a-fc099399100c","component_name":"FNpy7mXtvln0dnT1-FinalTestApp-srv","DCComponent":"","organization_name":"-","component_type":"application","space_name":"dev","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"a78252bf-72bf-479c-b761-8260de0c776e","Application":"FNpy7mXtvln0dnT1-FinalTestApp-srv","container_id":"10.0.138.113","type":"log","logger":"com.sap.cloud.sdk.service.prov.api.util.ProcessorHelper","thread":"http-nio-0.0.0.0-3000-exec-7","level":"ERROR","categories":[],"msg":"The endpoint responded with HTTP error code 400.nProvide atleast one description for the product.nFull error message: nn "error": n "code": "API_PRD_MSG/004",n "message": n "lang": "en",n "value": "Provide atleast one description for the product."n ,n "innererror": n "application": n "component_id": "LO-MD-MM",n "service_namespace": "/SAP/",n "service_id": "API_PRODUCT_SRV",n "service_version": "0001"n ,n "transactionid": "C16DD240C7520010E005C7E648BC12F5",n "timestamp": "20190311035627.5989630",n "Error_Resolution": n "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",n "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"n ,n "errordetails": [n n "code": "API_PRD_MSG/004",n "message": "Provide atleast one description for the product.",n "propertyref": "",n "severity": "error",n "target": ""n n ]n n n","stacktrace":["java.lang.reflect.InvocationTargetException","tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","tat


my-service.cds



 using API_PRODUCT_SRV from '../srv/external/csn/API_PRODUCT_SRV.json';
service ProductService

entity Products as Projection on API_PRODUCT_SRV.A_ProductType
key Product,
ProductType,
CreationDate,
CrossPlantStatus,
CrossPlantStatusValidityDate,
CreatedByUser,
LastChangeDate,
LastChangedByUser,
IsMarkedForDeletion,
ProductOldID,
GrossWeight,
PurchaseOrderQuantityUnit,
SourceOfSupply,
WeightUnit,
NetWeight,
CountryOfOrigin,
CompetitorID,
ProductGroup,
BaseUnit,
ItemCategoryGroup,
ProductHierarchy,
Division,
VarblPurOrdUnitIsActive,
VolumeUnit,
MaterialVolume,
ANPCode,
Brand,
ProcurementRule,
ValidityStartDate,
LowLevelCode,
ProdNoInGenProdInPrepackProd,
SerialIdentifierAssgmtProfile,
SizeOrDimensionText,
IndustryStandardName,
ProductStandardID,
InternationalArticleNumberCat,
ProductIsConfigurable,
IsBatchManagementRequired,
ExternalProductGroup,
CrossPlantConfigurableProduct,
SerialNoExplicitnessLevel,
ProductManufacturerNumber,
ManufacturerPartProfile,
ChangeNumber,
MaterialRevisionLevel,
HandlingIndicator,
WarehouseProductGroup,
WarehouseStorageCondition,
StandardHandlingUnitType,
SerialNumberProfile,
AdjustmentProfile,
PreferredUnitOfMeasure,
IsPilferable,
IsRelevantForHzdsSubstances,
QuarantinePeriod,
TimeUnitForQuarantinePeriod,
QualityInspectionGroup,
AuthorizationGroup,
HandlingUnitType,
HasVariableTareWeight,
MaximumPackagingLength,
MaximumPackagingWidth,
MaximumPackagingHeight,
to_Description

entity A_ProductDescriptionType as Projection on API_PRODUCT_SRV.A_ProductDescriptionType

key Product,
key Language,
ProductDescription




Can u please tell how to add associations in it?
my-service.cds



using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER';

service CrudService

@cds.persistence.skip
Entity BusinessPartner as projection on bp.A_BusinessPartnerType
BusinessPartner,
LastName,
FirstName,
BusinessPartnerCategory
;



Warm regards,



Meenakshi







s4sdk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 11 at 7:52







Meenakshi

















asked Mar 8 at 4:29









MeenakshiMeenakshi

62




62












  • Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

    – Henning Heitkötter
    Mar 8 at 7:35











  • Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

    – Meenakshi
    Mar 11 at 4:12












  • Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

    – Meenakshi
    Mar 11 at 7:50











  • Can you also print the content of req.getMapData()? Does it contain the payload you expect?

    – Henning Heitkötter
    Mar 11 at 16:37











  • No it is not giving the right payload..It is only getting product entity data and not the product description data.

    – Meenakshi
    Mar 12 at 4:18


















  • Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

    – Henning Heitkötter
    Mar 8 at 7:35











  • Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

    – Meenakshi
    Mar 11 at 4:12












  • Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

    – Meenakshi
    Mar 11 at 7:50











  • Can you also print the content of req.getMapData()? Does it contain the payload you expect?

    – Henning Heitkötter
    Mar 11 at 16:37











  • No it is not giving the right payload..It is only getting product entity data and not the product description data.

    – Meenakshi
    Mar 12 at 4:18

















Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

– Henning Heitkötter
Mar 8 at 7:35





Can you log or inspect the value of the toCreate object after you have used ModelMapper? Maybe it does not contain the description value you expect.

– Henning Heitkötter
Mar 8 at 7:35













Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

– Meenakshi
Mar 11 at 4:12






Hi Henning Heikotter, Sorry for the delayed response.Yes,you are correct.I printed toCreate Object.It is null.But I have included mydesciption associated entity in cds file.I have added log file and my-service.cds file

– Meenakshi
Mar 11 at 4:12














Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

– Meenakshi
Mar 11 at 7:50





Can u please tell how to add associations in my-service.cds file? using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER'; service CrudService @cds.persistence.skip Entity BusinessPartner as projection on bp.A_BusinessPartnerType BusinessPartner, LastName, FirstName, BusinessPartnerCategory ;

– Meenakshi
Mar 11 at 7:50













Can you also print the content of req.getMapData()? Does it contain the payload you expect?

– Henning Heitkötter
Mar 11 at 16:37





Can you also print the content of req.getMapData()? Does it contain the payload you expect?

– Henning Heitkötter
Mar 11 at 16:37













No it is not giving the right payload..It is only getting product entity data and not the product description data.

– Meenakshi
Mar 12 at 4:18






No it is not giving the right payload..It is only getting product entity data and not the product description data.

– Meenakshi
Mar 12 at 4:18













1 Answer
1






active

oldest

votes


















0














Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.



Please check the following documentation to define your entities and associations:



https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html



I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.



Thanks,
Kranti






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056740%2fnot-able-to-perform-deep-insert-operation-for-api-product-srv-standard-whitelist%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.



    Please check the following documentation to define your entities and associations:



    https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html



    I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.



    Thanks,
    Kranti






    share|improve this answer





























      0














      Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.



      Please check the following documentation to define your entities and associations:



      https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html



      I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.



      Thanks,
      Kranti






      share|improve this answer



























        0












        0








        0







        Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.



        Please check the following documentation to define your entities and associations:



        https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html



        I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.



        Thanks,
        Kranti






        share|improve this answer















        Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.



        Please check the following documentation to define your entities and associations:



        https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html



        I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.



        Thanks,
        Kranti







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 21 at 3:30

























        answered Mar 19 at 4:03









        Kranti KhilariKranti Khilari

        11




        11





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056740%2fnot-able-to-perform-deep-insert-operation-for-api-product-srv-standard-whitelist%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved