on 2006 Jun 14 8:43 AM
Hi all, I've been trying to use DI Object's Special Prices to add a new record. I'm using SAP B1 2005 SP01 PL4. I've heard that this Special Price bug revolving Invalid Date Range was fixed in this patch, but I've tried many times to no avail.
Here is my code:
Private Sub InsertSpecialPrices()
Try
Dim oSpecialPrices As SpecialPrices = oCompany.GetBusinessObject(BoObjectTypes.oSpecialPrices)
' SpecialPrices settings
oSpecialPrices.ItemCode = "A1000"
oSpecialPrices.CardCode = "C1000"
oSpecialPrices.AutoUpdate = BoYesNoEnum.tYES
oSpecialPrices.PriceListNum = 3
oSpecialPrices.DiscountPercent = 50
' -
START -
' SpecialPricesDataAreas settings
oSpecialPrices.SpecialPricesDataAreas.SetCurrentLine(0)
oSpecialPrices.SpecialPricesDataAreas.DateFrom = "2006-06-13"
oSpecialPrices.SpecialPricesDataAreas.Dateto = "2006-06-20"
oSpecialPrices.SpecialPricesDataAreas.AutoUpdate = BoYesNoEnum.tYES
oSpecialPrices.SpecialPricesDataAreas.Discount = 15
oSpecialPrices.SpecialPricesDataAreas.PriceListNo = oSpecialPrices.PriceListNum
oSpecialPrices.SpecialPricesDataAreas.PriceCurrency = "GBP"
oSpecialPrices.SpecialPricesDataAreas.Add()
' -
END -
oSpecialPrices.Add()
oCompany.GetLastError(lErrCode, sErrMsg)
If lErrCode <> 0 Then
MsgBox(lErrCode & ": " & sErrMsg)
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
I always get the message "Invalid Date Range", unless I comment out the region between START and END as shown above.
I've even tried other forms of dates like "new Date(2006, 06, 15)", "20060516", "2006-05-16", etc. Can someone tell me if there is anything wrong?
Thanks for assisting,
Keith Leow
Hi All ,
I am also getting the same problem. Please help me .
Thanks & Regards
Madhubalan .R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Keith
Those fields are of date type, I suggest you convert before asign to date.
oSpecialPrices.SpecialPricesDataAreas.DateFrom = CDate("2006/06/13")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jose
Thanks for replying. I've tried using Date objects too:
oSpecialPrices.SpecialPricesDataAreas.DateFrom = CDate("2006/06/13")
oSpecialPrices.SpecialPricesDataAreas.Dateto = CDate("2006/06/20")
and even
oSpecialPrices.SpecialPricesDataAreas.DateFrom = new Date(2006, 06, 13)
oSpecialPrices.SpecialPricesDataAreas.Dateto = new Date(2006, 06, 20)
but both still gave the [Invalid Date Range] error. =(
Keith
Hi Jose,
Yes this error is from SAP, specifically from the oCompany.GetLastError method.
I've tried all sorts of Date format, and using both String and Date type, and in all cases I still get the Invalid Date Range error.
I'm pretty sure this is not about the date input format, because incorrect date format would have thrown me an exception on SQL's expression error. This error is more likely that SAP treats my input to be of incorrect RANGE.
I've made sure that my DateFrom is definitely earlier than my DateTo field. So now I'm at a total lost about what to do.
Perhaps I should ditch the Special Prices object and directly manipulate the data from OSPP and SPP1?
User | Count |
---|---|
116 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.