DI API: 2005A PL: 08  Special Prices

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

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?

Similar Messages

  • [Special Prices for Business Partners] and [Hierarchies and Expansions]

    Dear Sirs,
    I am running into three problems.
    1.) I loaded 313 items Special Prices by DTW however I can not locate where it went?
         I searched via the path [Inventory>Price Lists>Special Prices>Special Prices for Business Partners]but find nothing in there.
    2.) I can not find DTW templates for Hierarchies and Expansions data load.
         Also I searched via the path [Inventory>Price Lists>Special Prices>Hierarchies and Expansions] to see if the Special Prices I loaded with DTW maybe there but find nothing there.
    3.) I can not find any information related to Hierarchies and Expansions in the [diapi] help file.
    Could it be these two functionalities require "manual" input?
    If so, how on earth the 313 Special Prices DTW data load went through "successfully" and find no trace of it?
    I am pulling my hair off to find some advice.
    Would appreciate it greatly if someone could enlighten me on these two functionalities.
    Kuni - Tokyo
    Edited by: furuya kunitomo on May 15, 2009 2:28 PM

    Hi Kuni,
    To quickly answer your questions:
    1.) I loaded 313 items Special Prices by DTW however I can not locate where it went?
    The path is correct. If you can't find anything probably something went wrong in the DTW import.
    Check that the "Test Run" checkbox was not checked and all required keys are entered in the templates.
    2.) I can not find DTW templates for Hierarchies and Expansions data load.
    The relevant templates are:
    SpecialPrices.xlt
    SpecialPricesDataAreas.xlt
    SpecialPricesQuantityAreas.xlt
    the default location when installing DTW is:
    C:\Program Files\SAP\Data Transfer Workbench\Templates\Templates\oSpecialPrices
    When entering Hierarchies and Expansions (renamed to Period and Volume Discount in Version 2007) you must enter *x for CardCode where x is the price list number.
    3.) I can not find any information related to Hierarchies and Expansions in the diapi help file.
    The information in the DI API file is under the SpecialPrices Object.
    See below some general information regarding special prices:
    SpecialPrices is a business object part of the Inventory and Production module under
    Select Inventory > Price Lists > Special Prices > Special Prices for Business Partners.
    OR
    Select Inventory > Price Lists > Period and Volume Discount (Hierarchies and Expansions in previous versions)
    Interesting points:
    Source table: OSPP
    DTW Template: SpecialPrices.csv
    Mandatory fields in SAP Business One: CardCode and ItemCode.
    PriceListNum is a foreign key to the PriceLists object - source table OPLN, field name ListNum.
    CardCode is the Business Partner CardCode to enter Special Prices for Business Partners.
    Child object of the SpecialPrices Object: SpecialPricesDataAreas (source table: SPP1)
    DTW Template: SpecialPricesDataAreas.csv
    LineNum (Field name LINENUM) - Always enter the appropriate LineNumber you want to update (starts from 0).
    Child object of the SpecialPricesDataAreas Object: SpecialPricesQuantityArea (source table: SPP2)
    DTW Template: SpecialPricesQuantityAreas.csv
    LineNum (Field Name SPP2LNum). Always enter the appropriate LineNumber you want to update (starts from 0).
    Hope that information helps a little. If you have any fruther questions enter the following information:
    1. SAP Business One Version including Patch level
    2. Do you get any error message after the import? What is the message returned?
    Kind Regards,
    Friederike Mundt
    SAP Business One Forums Team

  • Prices on invoices not mantained - Discounts - Special Prices

    Hello everybody,
    I'm developing with SBO2005 A PL7 and DI API.
    I have this problem with an our addon that generates invoices.
    If I set this properties:
    .Lines.Price = X
    .Lines.DiscountPercent = Y
    and I have Stock Management - Price Lists - Special Prices - Discount Groups setted for this customer,
    the price X comes mantained ok, but the DiscountPercent Y comes overwritten on this instruction:
    objInvoice.Add as if it takes another PriceList.
    Do you know why?
    How can I set this field AR/Invoice - Form Settings  - Price List (for the document)?
    Thank you
    Andy

    I intended the field Price List field in [Form 998, Item = 31, Variable = 2, OCTG.ListNum]
    Thank you again

  • Import Special Price for Groups OSPG Table.

    Dear all
    I need to import Special Price for Groups (table OSPG) but there is no template in DTW.
    How can I do.
    Tanks and Regards
    Graziano Di Risio

    Dear Graziano Di Risio,
    As you know, DTW is based on DI API.  Since this table is not exposed to DI API, you will have no option to DTW it.  That is all.  You have to do it manually.
    Thanks,
    Gordon

  • Report to show changes in special prices

    Hi All
    We are having a problem currently where some users change the prices in the system and since the special prices table or price table does not have a log it makes it difficult to check who changed the prices from what price to what price and when.
    So as a solution I am looking for a report or function that will alert me when there is any price change, or a log file that can log any price changes in the system.
    We are using SBO 8.81 A PL09

    Hi,
    You've posted your question in the System Administration forum which is for system installation and configuration topics. Your question would be better placed in the reporting forum:
    http://scn.sap.com/community/business-one/reporting-and-printing/content?filterID=content~objecttype~objecttype[thread]
    or in the general application forum:
    http://scn.sap.com/community/business-one/content
    In answer to the question, I think you could probably create your own logging solution by creating a separate SQL table and using a script in the SBO_SP_TransactionNotification proc to insert a record in this table when a user updates a special price. The SBO client will pass the CardCode and ItemCode properties through in the proc. The object type is 7. The OSPP has a UserSign field but I'm not sure if that holds the UserID of the original user who created the special price or if its the user who last updated the record. You'd have to test that. Alternatively you could develop an add-on that runs in the GUI to track the user clicking on Add/Update in the special pricing screen and recording the details.
    Kind Regards,
    Owen

  • Business Partner Special Price Import - DTW

    Forum,
    We have a number of special prices for Business Partners which we'd like to update. In some cases, we would like to remove the current special price and have the system pick up the unit price against an item within Item Master Data.
    When importing through DTW using the OSPP template, we have entered '0' as the price. This correctly imports in through DTW and removes the special price however, when we then raise a sales order for that item. The unit price is zero and it hasn't picked up the unit price against the item within item master data.
    Is this how it works or is there a setting we're perhaps missing? I have test this in the demo and it does pick up the unit price from item master. In our set of data, it does not.
    Regards,
    Juan

    Hi Juan,
    You may check:
    Re: Price List table not updated
    Prices auto adjusted when setting up BP Special Prices
    Thanks,
    Gordon

  • Absolute value discount in Special Prices

    I have a customer that has special prices with a value discount, not a percentage one.
    I thought about adding a UDF to the Special Prices table and do a formatted search against it, but later I found that I cannot add an UDF to the Special Prices table...
    All the discount functionality in SBO is percentage based...how should I implement an absolute value discount?
    Any ideas will be much appreciated...

    Hi.
    This is sample code in C++ to add UDF.
    _bstr_t TableName = L"TableUID";
    _bstr_t FieldName;
    HRESULT hr;
    SAPbobsCOM::IUserFieldsMDPtr m_pUserFieldsMD = m_Cmp->GetBusinessObject( SAPbobsCOM::oUserFields );
    m_pUserFieldsMD->PutTableName(TableName);
    FieldName = L"FieldUID";   'without U_'
    m_pUserFieldsMD->PutType(SAPbobsCOM::db_Alpha);
    m_pUserFieldsMD->PutName( FieldName );
    m_pUserFieldsMD->PutDescription( L"desc");          
    m_pUserFieldsMD->PutSize(20);
    m_pUserFieldsMD->PutEditSize(20);
    if ( m_pUserFieldsMD == NULL )
    return -1;
    m_Cmp->StartTransaction();
    hr = m_pUserFieldsMD->Add();
    if (hr!=S_OK)
    'error'
    if ( m_Cmp->InTransaction )
    m_Cmp->EndTransaction( SAPbobsCOM::wf_Commit );
    Hope it helps.
    Kamil Wydra

  • Changing colors in special prices BP

    Hi all,
    When hierarchies are available per article in the function Special prices per BP, all figures are automatically blue, when there are no hierarchies, all figures stays black.
    The difference between blue and black is hard to see for some people.
    The blue color is also visible in sales/purchase orders when hierarchies are available, but sometimes hard to see the difference.
    Can these colors be changed??
    Thanks in advance.
    Best regards,
    Carl Verhagen

    Carl,
    I am not sure if the colors can be changed.  I agree sometimes it could be hard to differentiate the colors.
    You might try posting the question to the SDK forum to get some insights on what options are available through SDK.
    Good luck
    Suda

  • Query to see all BP's with a special price for an item

    Hi There,
    I'm currently still learning the product and have been tasked with finding this out, so please bear with me and let me know if there is further information that is required.
    I have a customer running SAP B1 2007 who wishes to produce a report detailing all of the BP's that have a special price for an item. 
    Therefore it would ideally show the item number, all BP's who have a special price and what that price is.
    Is there a standard report that can be run for this?  Or would a query have to be defined?
    Any help would be appreciated.

    Hi,
    AFAIK, no standard report for this. But need not to worry, you just need
    SELECT ItemCode,CardCode,Price FROM OSPP ORDER BY ItemCode,CardCode
    above simple query to cater your need.
    Best Regards,
    Hendry Wijaya

  • Price and special price

    Hello
    My question is about special price and depending on the last price a discount applies
    Example discount 10%
    Customer A no special price for article B 100 so with discount it'll be 90
    Customer B special price for article B 70 so with discount it'll be 63
    Thanks

    You can use the Special Price for BP's

  • How to copy Sales Quotaton prices to Price List or Special Prices

    We frequently use Sales Quotation to communicate deal price offers to customers.  Once these prices are approved, we have to re-type these prices into applicable price lists or special prices. 
    We are looking for a way to copy these deal prices from Sales Quotation (by Business Partner) over to the applicable price list and special prices?
    Please assist?
    Jaco de Villiers

    I was told by my Implementation Partner that it is possible to import and update price list by using the Import function that is available in SBO.  To do this:
    1. From your sales quotation with the agreed prices - export to excel.
    2. Change the format to list: Product code, Price list to update, New price, Currency
    3. Save the file as tab delimited text
    4. Import into SBO using the Administration, Data Import/Export, Data Import, Import from Excel option.
    5. Choose Item type to import
    6. In the B line, choose Price List Code, the list updates to show only the fields relevant to price list updates
    7. Press OK and follow rest of instructions to complete the import.
    I found the above to be simple, repeatable and reliable enough to solve my initial question.

  • Change Log needed at price list and special prices

    Tracking changes made to the price list and special prices by BP is a valuable control function missing that needs to be included in future.

    I was told by my Implementation Partner that it is possible to import and update price list by using the Import function that is available in SBO.  To do this:
    1. From your sales quotation with the agreed prices - export to excel.
    2. Change the format to list: Product code, Price list to update, New price, Currency
    3. Save the file as tab delimited text
    4. Import into SBO using the Administration, Data Import/Export, Data Import, Import from Excel option.
    5. Choose Item type to import
    6. In the B line, choose Price List Code, the list updates to show only the fields relevant to price list updates
    7. Press OK and follow rest of instructions to complete the import.
    I found the above to be simple, repeatable and reliable enough to solve my initial question.

  • Special Price Management

    Forum,
    I would like some advice on the best way to handle special prices in "Period and volume discount" currently we have a couple of thousand items in this aera, but only a couple of hundred that are needed. i would like my colleagues (who enter the special prices) to manage this better i.e. when an item is not on special offer (or is not a bulk buy item) for them to remove from this list.  can you let me know what other companys do to manage this area. and if there is an easy way to manage this better.
    Regards,
    Juan

    Would anyone on the forum be able to assist?
    Regards,
    Juan

  • Future Dated Special Prices

    I have created a Special Price that does not go into affect until a future date. When the item associated with this special price is entered in an order for the BP, no price comes up. It appears that the existence of the special price stops SAP from looking elsewhere yet because the special price is not in affect yet relative to the date entered, no price is retrieved. The BP has a Discount Group that supports a price for the Item and the BP has a default price list. One would expect that SAP would look for a Special Price for the date on the order, not find it because of the date set in the Special Price,  and then go look at Discount Group and find the price there. I wouldn't expect that I would have to enter a line in the Special price to support the BP until the future date is reached. Bug or poor functionality?

    Hi Chris,
    I'm not able to replicate that behaviour.  The system however doesn't operate quite as you expect, as special prices always override discount groups.  So when we set up a special price it has to have a price in the main special prices window as well as in the period discounts window.  then when you key an order, it will use the price from the special prices window over any discount group price until the period discount comes into effect.
    Perhaps you have no price in the main special prices window?
    Michael

  • Prices auto adjusted when setting up BP Special Prices

    In the BP Special Prices, based on different quantity, the user had set up prices accordingly. They would like the price to be fixed and not be adjusted.
    If the Auto is checked in the Special Prices for BP, the Unit Price after Discount will varies. This is misleading to the supplier if they received the Purchase Order print.
    If the Auto is unchecked, the Unit Price before Discount will varies. Again, this will be misleading to the AP Department when checking on the original price of the item.
    Would like to maintain the price accordingly to what the user had setup without variations.

    Dear Mr See,
    According to my tests, when you untick the auto box the price does not vary even if the base price in the price list does vary.
    If the customer does not want that the price changes according to the changes in the base price list, ask him/her to untick this box.
    I am not sure why you refer to the Purchase Order print. Is the price in the Purchase Order stored in a price list? Is this price list considered as base price list for another one?
    Kind Regards,
    Marcella Rivi
    SAP Business One Forum Teams

Maybe you are looking for