Hello,
I'm trying to insert discount prices by diapi and I can't find a way to do it.
Here there is my code:
Dim oSpecial As SpecialPrices
Set oSpecial = pCompany.GetBusinessObject(BoObjectTypes.oSpecialPrices)
oSpecial.CardCode = Sheets(sheet).Cells(lIndexLineas, "K")
oSpecial.Currency = "EUR"
oSpecial.PriceListNum = 1
oSpecial.Price = Sheets(sheet).Cells(lIndexLineas, "D")
oSpecial.ItemCode = Sheets(sheet).Cells(lIndexLineas, "A")
oSpecial.SpecialPricesDataAreas.PriceListNo = 1
oSpecial.SpecialPricesDataAreas.SetCurrentLine (0)
oSpecial.SpecialPricesDataAreas.DateFrom = CDate(Sheets(sheet).Cells(lIndexLineas, "F"))
oSpecial.SpecialPricesDataAreas.Dateto = "2020-01-01"
oSpecial.SpecialPricesDataAreas.PriceListNo = 1
oSpecial.SpecialPricesDataAreas.AutoUpdate = SAPbobsCOM.BoYesNoEnum.tYES
oSpecial.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SetCurrentLine (0)
oSpecial.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Quantity = 1 'CInt(9)
oSpecial.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SpecialPrice = CDbl(100) 'Sheets(sheet).Cells(lIndexLineas, "D")
oSpecial.SpecialPricesDataAreas.DateFrom = CDate(Sheets(sheet).Cells(lIndexLineas, "F"))
oSpecial.SpecialPricesDataAreas.Dateto = Sheets(sheet).Cells(lIndexLineas, "Q")
oSpecial.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Add
ret = oSpecial.Update
ret = oSpecial.Add
I'd tried a lot of things, but nothing worked, I always get "Invalid date range" error.