使用B1服务层删除文档行。

2020-08-30 19:53发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我们的应用程序正在使用服务层将新...

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

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


我们的应用程序正在使用服务层将新的销售订单过帐到B1中。

有时销售线需要稍后通过服务层进行更新,有时更新后的订单行要少于原始的。
< br>以下代码创建一个三行订单。

POST https://hanab1vm2:50000/b1s/v1/Orders
{" CardCode":" C40000"," U_JC1_CIS_Num":" 20" ," U_JC1_CIS_Id":" 10024"," DocDate":" 2019-10-23"," DocDueDate":" 0001-01-01"," Comments":"",
" TransportationCode":"-1 "," Confirmed":" tYES"," U_JC1_QNOTES":""," U_JC1_ShortDesc":""," ShipToCode":" Ship To"," NumAtCard":""," SalesPersonCode":-1,
" DocCurrency":" $"," DiscountPercent":0:
" DocumentLines":[
{" TaxCode":""," DiscountPercent":0," ItemCode":" A00006"," ItemDescription" :"彩虹1200激光系列","单价":500,"数量":1,
"运输方式":-1," U_JC1_CIS_Id":" 51"," U_JC1Answr":""},
{ " TaxCode":""," DiscountPercent":0:" ItemCode":" B10000"," ItemDescription":"打印机标签"," UnitPrice":1.25," Quantity":1,
" Shippi ngMethod":-1," U_JC1_CIS_Id":" 53"," U_JC1Answr":""},
{" TaxCode":""," DiscountPercent":0:" ItemCode":" S10000"," ItemDescription" :"服务器点10000","单价":2300,"数量":1,
" ShippingMethod":-1," U_JC1_CIS_Id":" 54"," U_JC1Answr":""}],
" DocumentSpecialLines":[]}


我们需要通过删除中间行来仅用两行更新订单,如下所示:


PATCH https://hanab1vm2:50000/b1s/v1/Orders(431)
{" CardCode":" C40000"," U_JC1_CIS_Num":" 20"," U_JC1_CIS_Id":" 10024"," DocDate":" 2019-10-23"," DocDueDate":" 0001-01-01","注释":"",
" TransportationCode":"-1"," Confirmed":" tYES"," U_JC1_QNOTES":""," U_JC1_ShortDesc":" "," ShipToCode":"运送至"," NumAtCard":""," SalesPersonCode":-1,
" DocCurrency":" $"," DiscountPercent":0:
" DocumentLines":[
{" TaxCode":""," DiscountPercent":0:" ItemCode":" A00006"," ItemDescription":" Rainbow 1200 Laser Series"," UnitPrice":500," Quantity":1,
" ShippingMethod":-1," U_JC1_CIS_Id":" 51"," U_JC1Answr":""},
{" TaxCode":""," DiscountPerc ent":0," ItemCode":" S10000"," ItemDescription":"服务器点10000"," UnitPrice":2300," Quantity":1,
" ShippingMethod":-1," U_JC1_CIS_Id":" 54"," U_JC1Answr":""}],
" DocumentSpecialLines":[]}


结果是该订单仍具有三行而不是两行。 前两行被覆盖,但第三行仍然像以前一样不正确,并导致第二行重复两次。

我们如何才能更新订单,使订单最终以正确的状态显示,只有两行? 我无法在线或在服务层文档中找到答案。


感谢您的帮助。

3条回答
歪着头看世界
2020-08-30 20:23

在整个文档行结构中使用PUT方法,不包括要删除的行。

一周热门 更多>