cancel
Showing results for 
Search instead for 
Did you mean: 

update GrossPrice in Sales Document using B1WS?

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Johan_H
Active Contributor
0 Kudos

Hi,

As it seems the actual order creating happens in your self made (?) objects (

myOrder.DocumentLines = New OrdersService.DocumentDocumentLine(RowCount)

) it is hard to tell from this code what is happening.

For example what does this do ? :

myOrder.DocumentLines(Count - 1).PriceAfterVATSpecified = True

If there is no reason to be found in the code, you could consider reverse calculating the price after vat, and adding the order lines using:

myOrder.DocumentLines(Count - 1).Price = ReverseCalculatedPriceWithoutVat

The

.Price

property should at least always override any prices determined in price lists and special prices.

Regards,

Johan

Former Member
0 Kudos

Johan:

I simply modified the sample code of B1WS. Codes like "myOrder.DocumentLines(Count - 1).PriceAfterVATSpecified = True" is to set value of PriceAfterVAT, which is defined in a wsdl file.

I guess it's a bug here in B1WS. Anyway, thank you for your information.

Answers (0)