Skip to Content
0
Former Member
Apr 08, 2009 at 04:35 AM

update GrossPrice in Sales Document using B1WS?

30 Views

Hi, every one:

I tried to update PriceAfVat in Document_lines of SaleOrder with B1WS. What's strange was that if the PriceAfVat was 0, I could update PriceAfVat with a new Price. But if the PriceAfVat was not 0, the resulting PriceAfVat was the price in PriceList set in corresponding BP master data (OCRD.ListNum).

here is my code:

                Dim myOrderService As OrdersService.OrdersService = New OrdersService.OrdersService
                Dim msgHeader As OrdersService.MsgHeader = New OrdersService.MsgHeader()
                msgHeader.SessionID = SessionID
                msgHeader.ServiceName = OrdersService.MsgHeaderServiceName.OrdersService
                msgHeader.ServiceNameSpecified = True

                myOrderService.MsgHeaderValue = msgHeader
                Dim myOrderParams As OrdersService.DocumentParams = New OrdersService.DocumentParams
                myOrderParams.DocEntry = DocEntry
                myOrderParams.DocEntrySpecified = True

                Dim myOrder As OrdersService.Document = New OrdersService.Document
                myOrder = myOrderService.GetByParams(myOrderParams)

                myOrder.DocTotalSpecified = False
                myOrder.DocTotal = Nothing

                myOrder.DocumentLines = New OrdersService.DocumentDocumentLine(RowCount) {}
                For Count = 1 To RowCount
                        myOrder.DocumentLines(Count - 1) = New OrdersService.DocumentDocumentLine
                        ...//these are codes that set ItemCode, Dscription, Quantity, VatGroup.
                        myOrder.DocumentLines(Count - 1).PriceAfterVAT = 650
                        myOrder.DocumentLines(Count - 1).PriceAfterVATSpecified = True
                Next
                myOrderService.Update(myOrder)

Can anybody help me?