通过PATCH数据更新SAP SL中的业务伙伴时出错

2020-09-13 05:57发布

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

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


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

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


付费偷看设置
发送
2条回答
Baoming ROSE
1楼 · 2020-09-13 06:00.采纳回答

嗨,拉吉,

我假设您复制了一个现有地址,并且只是更改了一些字段。 但是您忘记更改RowNum属性值:

" BPAddresses":[
     {
         " AddressName":"帐单地址",
         "街道":"海洋大道",
         "阻止":null,
         " ZipCode":" 12345",
         " City":" NEWPORT",
         " Country":" US",
         " State":" OR",
         " BuildingFloorRoom":"",
         " AddressType":" bo_BillTo",
         " StreetNo":null,
         " BPCode":" T10360",
         " RowNum":0,
         " GlobalLocationNumber":null,
         "国籍":null,
         " TaxOffice":null,
         " GSTIN":null,
         " GstType":null,
         " U_WBCUSTADDID":null,
         " U_TelNo":null
     },
     {
         " AddressName":" RONY BANERJEE UPDATED",
         "街道":"海洋大道",
         "块":" NEWPORT",
         " ZipCode":" 12345-5300",
         " City":" NEWPORT",
         "县":null,
         " Country":" US",
         " State":" OR",
         " FederalTaxID":null,
         " TaxCode":" CA0",
         " BuildingFloorRoom":"",
         " AddressType":" bo_ShipTo",
         " AddressName2":null,
         " AddressName3":null,
         " TypeOfAddress":null,
         " StreetNo":null,
         " BPCode":" T10360",
         " RowNum":1,-重复值
         " GlobalLocationNumber":null,
         "国籍":null,
         " TaxOffice":null,
         " GSTIN":null,
         " GstType":null,
         " U_WBCUSTADDID":null,
         " U_TelNo":" T10360"
     },
     {
         " AddressName":" DEPT OF COMMERCE1",
         " Street":" Marine Drive 2",
         "阻止":null,
         " ZipCode":" 97365-1234",
         " City":" NEWPORT",
         "县":null,
         " Country":" US",
         " State":" OR",
         " FederalTaxID":null,
         " TaxCode":" CA0",
         " BuildingFloorRoom":"",
         " AddressType":" bo_ShipTo",
         " AddressName2":null,
         " AddressName3":null,
         " TypeOfAddress":null,
         " StreetNo":null,
         " BPCode":" T10360",
         " RowNum":1,-重复值
         " GlobalLocationNumber":null,
         "国籍":null,
         " TaxOffice":null,
         " GSTIN":null,
         " GstType":null,
         " U_WBCUSTADDID":null,
         " U_TelNo":null
     }
 ]
 

因此它的第一个地址值为0,第二个和第三个值为1。 这就是为什么您会收到此错误。

BP地址数据库实体具有CardCode和RowNumber的复合主键,因此,如果要添加新地址,则可以只添加PATCH而没有RowNum值(将分配一个递增的值),例如:

 {
     " BPAddresses":[
                 {
                     " AddressName":" Ship 1121",
                     "街道":" 6001 Eastern Blvd",
                     "阻止":null,
                     " ZipCode":" NW2 7YT",
                     "城市":"纽卡斯尔",
                     " County":" Tyne and Wear",
                     "国家/地区":" GB",
                     "状态":null,
                     " FederalTaxID":" GB509349049",
                     " TaxCode":null,
                     " BuildingFloorRoom":"",
                     " AddressType":" bo_ShipTo",
                     " AddressName2":null,
                     " AddressName3":null,
                     " TypeOfAddress":null,
                     " StreetNo":null,
                     " BPCode":" V10000"
                 }
     ]
 }
 

然后,如果要更新它,则需要传递具有分配的递增RowNum值的新值,例如:

 {
     " BPAddresses":[
                 {
                     " AddressName":" Ship 1121",
                     "街道":"新街道名称",
                     "阻止":null,
                     " ZipCode":" NW2 7YT",
                     "城市":"纽卡斯尔",
                     " County":" Tyne and Wear",
                     "国家/地区":" GB",
                     "状态":null,
                     " FederalTaxID":" GB509349049",
                     " TaxCode":null,
                     " BuildingFloorRoom":"",
                     " AddressType":" bo_ShipTo",
                     " AddressName2":null,
                     " AddressName3":null,
                     " TypeOfAddress":null,
                     " StreetNo":null,
                     " BPCode":" V10000",
                     "行数":4
                 }
     ]
 }
 

顺便说一句,它不是放置请求,而是补丁。 因此,如果您只需要更改某些属性,则只能传递此属性。 例如,在您的情况下,您只能传递带有地址的零件,然后地址将被更改,而其余地址则不会更改。

me_for_i
2楼-- · 2020-09-13 06:08

嗨,拉杰,

问题解决了吗?

一周热门 更多>

点击此处---> EasySAP.com 一起学习S4 HANA ...

相关问答