cancel
Showing results for 
Search instead for 
Did you mean: 

DI API: 2005A PL: 08 Special Prices

Former Member
0 Kudos

Hi everyone,

I am using the DI-Object SpecialPrices for adding a special price in the Database. We use a German MSSQL Server 2000 and VB.Net (1.1)

My Code:

Public Sub PreislisteZwischenspeichernLöschenUndSetzen()

'Dim oPreisliste As SAPbobsCOM.PriceLists

Dim oSonderpreisliste As SAPbobsCOM.SpecialPrices

Dim oSonderpreislisteDataArea As SAPbobsCOM.SpecialPricesDataAreas

Dim oSonderpreislisteQuantityArea As SAPbobsCOM.SpecialPricesQuantityAreas

Dim oSBOB As SAPbobsCOM.SBObob

oSBOB = oCibAddOn.oCompany.GetBusinessObject(BoObjectTypes.BoBridge)

'oPreisliste = oCibAddOn.oCompany.GetBusinessObject(BoObjectTypes.oPriceLists)

oSonderpreisliste = oCibAddOn.oCompany.GetBusinessObject(BoObjectTypes.oSpecialPrices)

' Staffelpreisliste neu eingeben

' Wichtig, Standardpreis muss in der Preisliste unter ITM1 eingegeben sein

Dim oArtikelPreis As SAPbobsCOM.Items

Dim oArtikelPreise As SAPbobsCOM.Items_Prices

oArtikelPreis = oCibAddOn.oCompany.GetBusinessObject(BoObjectTypes.oItems)

oArtikelPreis.GetByKey("9999")

Dim intIndex As Integer = 0

Dim blExit As Boolean = False

Do While blExit = False And intIndex < oArtikelPreis.PriceList.Count

oArtikelPreis.PriceList.SetCurrentLine(intIndex)

If oArtikelPreis.PriceList.PriceList = 1 Then

oArtikelPreis.PriceList.Currency = "EUR"

oArtikelPreis.PriceList.Price = 12.5

If oArtikelPreis.Update() <> 0 Then

MsgBox(oCibAddOn.oCompany.GetLastErrorDescription)

End If

blExit = True

End If

intIndex += 1

Loop

oSonderpreisliste.CardCode = "70000"

oSonderpreisliste.ItemCode = "9999"

oSonderpreisliste.Currency = "EUR"

oSonderpreisliste.Price = 12.5

oSonderpreisliste.PriceListNum = 1

oSonderpreisliste.SpecialPricesDataAreas.SetCurrentLine(0)

oSonderpreisliste.SpecialPricesDataAreas.AutoUpdate = BoYesNoEnum.tYES

oSonderpreisliste.SpecialPricesDataAreas.DateFrom = New System.DateTime(2006, 4, 26)

oSonderpreisliste.SpecialPricesDataAreas.Dateto = New System.DateTime(2006, 4, 28)

oSonderpreisliste.SpecialPricesDataAreas.PriceCurrency = "EUR"

oSonderpreisliste.SpecialPricesDataAreas.PriceListNo = 1

oSonderpreisliste.SpecialPricesDataAreas.SpecialPrice = 12.5

oSonderpreisliste.SpecialPricesDataAreas.Add()

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SetCurrentLine(0)

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.PriceCurrency = "EUR"

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Quantity = 1

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SpecialPrice = 12.5

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Add()

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SetCurrentLine(1)

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.PriceCurrency = "EUR"

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Quantity = 100

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SpecialPrice = 10

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Add()

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SetCurrentLine(2)

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.PriceCurrency = "EUR"

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Quantity = 1000

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.SpecialPrice = 7.5

oSonderpreisliste.SpecialPricesDataAreas.SpecialPricesQuantityAreas.Add()

If oSonderpreisliste.Add <> 0 Then

MsgBox(oCibAddOn.oCompany.GetLastErrorCode)

MsgBox(oCibAddOn.oCompany.GetLastErrorDescription)

End If

System.Windows.Forms.Application.Exit()

End Sub

We get all the time the errormessage: Date is out of range.

We also try to use the functions SaveAsXML and GetBusinessObjectFromXML, but then the same error comes.

Trinidad wrote a lot of time that the error is solved in the Version 2005, but it isn`t so for us.

Please help

Regards

Jörn

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

IMHO, this looks like a date format issue. I suppose you have tried with all kind of date format, the B1 one, SQL Server one, with different separator...

I would go with changing this two lines:

oSonderpreisliste.SpecialPricesDataAreas.DateFrom = New System.DateTime(2006, 4, 26)

oSonderpreisliste.SpecialPricesDataAreas.Dateto = New System.DateTime(2006, 4, 28)

with static dates like "{25/04/06}", "{04/25/06}"...

Hope helps,

Ibai Peñ

Former Member
0 Kudos

Hi Ibai,

thx for your Idea, I had to write before that I tried all date formats, also with #04.06.2006# and also I tried to use the DateTime-Object. Also I try to use the Cultureinfo-Objekt and set all parts of English and also in USEnglish to use all different formattes. Also I try to change the language of the SQL-Server, but nohting helps.

In this Forum are a few Topics with the same problem most of time for Version 2004A and some SAP-Employees said that the problem was fixed in version 2005A. I think the error message is not correct and the Object has an other Problem. May Be I will find a solution

Regards

Jörn

Former Member
0 Kudos

I bet the next answer will be: "It is fixed in 2005 SP1".

Sorry,

Ibai Peñ

Former Member
0 Kudos

I'm actually using 2005 SP1 PL04... and I'm getting the same problem no matter what kind of date format or values I use.

I keep getting error code (-10) and error message (Invalid Date Format) even with the simplest code to test it out.

Does anyone has a confirmed code sample that works for them?

Keith Leow

Former Member
0 Kudos

Sorry for the double post; I thought I would be better showing how my code goes.

As with the original poster, I am using the DI-object Special Prices to insert new records. I am trying to create a Special Price that is BP-Item specific, using the default demo company (SBO Demo UK), valid date from 15 Jun to 20 Jun.

Dim oSpecialPrices As SpecialPrices = oCompany.GetBusinessObject(BoObjectTypes.oSpecialPrices)
Dim oSpecialPricesDataAreas As SpecialPricesDataAreas = oSpecialPrices.SpecialPricesDataAreas

' SpecialPrices settings
oSpecialPrices.ItemCode = "A1000"
oSpecialPrices.CardCode = "C1000"
oSpecialPrices.AutoUpdate = BoYesNoEnum.tYES
oSpecialPrices.PriceListNum = 3
oSpecialPrices.DiscountPercent = 50

' ------------------ START ------------------
' SpecialPricesDataAreas settings
oSpecialPricesDataAreas.SetCurrentLine(0)
oSpecialPricesDataAreas.DateFrom = New DateTime(2006, 6, 15)
oSpecialPricesDataAreas.Dateto = New DateTime(2006, 6, 20)
oSpecialPricesDataAreas.AutoUpdate = BoYesNoEnum.tYES
oSpecialPricesDataAreas.Discount = 15
oSpecialPricesDataAreas.PriceListNo = oSpecialPrices.PriceListNum
oSpecialPricesDataAreas.PriceCurrency = "GBP"
oSpecialPricesDataAreas.Add()
' ------------------- END -------------------

' Adding and checking for any errors
oSpecialPrices.Add()

oCompany.GetLastError(lErrCode, sErrMsg)
If lErrCode <> 0 Then
    MsgBox(lErrCode & ": " & sErrMsg)
End If

If the portion of the code between START and END was commented out the insertion was successful. Else as it is, it will keep prompting Invalid Date Range (-10).

Can anyone please shower some enlightenment?

Former Member
0 Kudos

Sorry Keith I didn`t tested your Code.

But I resolve the Problem. I use oSpecialPrices.SpecialDataAreas.DateFrom = "2006-01-25"

oSpecialPrices.SpecialDataAreas.DateTo = "2006-01-30".

It was only a Problem in PL 08. In PL 05, PL 06 AND PL 10 + PL 11 and also in SP01 PL 04 it still works.

But thanks for your idea

Answers (0)