I have a function that ships SOs using the CustShip BO with the following methods in the same order as below:
HEADER
- GetNewShipHead
- GetHeadOrderInfo
- GetLegalNumGenOpts
- CheckPCBinOutLocation
- UpdateMaster
LINES
- GetRows (without lines)
- GetNewOrdrShipDtl
- GetOrderInfo (first line only)
- GetOrderLineInfo
- GetOrderRelInfo
- GetPartInfo
- GetWhseInfo
- ValidateBinCode
- GetQtyInfo
- CheckPCBinOutLocation
- UpdateMaster
When adding lines, the important thing is that you should never have any lines in your dataset except the new one. That’s why adding the first line works and the next ones don’t. When adding second/third/etc line, you need to remove the previous lines from the dataset.
So, instead of GetByID which gets all lines, I use GetRows with the line parameter ‘PackLine = 0’ to get the whole dataset but without the lines. And only then I call GetNewOrdrShipDtl. I hope this makes sense.
LE: see below what I mean. @josecgomez uses csts.ShipDtl.Clear after GetByID there which does the same thing.