Discount Groups Query Question

My goal is to create a query that shows all BP's that have a Discount by Group set for them that is greater than zero.  I get output that repeats every discount group for every unique discount that exists in the system.
I need help to enhance this query to strip out the redundant and inaccurate records.
Query Code:
SELECT T2.[CardCode] AS 'BP Code', T1.[CardName] AS 'BP Name', T0.[ItmsGrpNam] AS 'Group Name', T2.[Discount] AS 'Discount' FROM  [dbo].[OITB] T0 ,  [dbo].[OCRD] T1  INNER  JOIN [dbo].[OSPG] T2  ON  T2.[CardCode] = T1.CardCode   WHERE T2.[Discount] > 0
Thanks,
Glen

Hi Glen,
The OSPG table holds special price data for Item Groups, Item Properties and Companies. SBO identifies these different types using the ObjType column in this table. The database reference in the SDK Help Center will show you the constraints on this column:
52 = Item Group
8  = Item Property
43 = Companies
Depending on the ObjType, the ObjKey field will then contain the key for linking back to the relevant table (eg if the ObjType is 52 then the ObjKey will contain the Item Group code to link to the OIBT table). Put this together and you get:
OIBT T0 inner join OSPG T2 on T2.ObjType = 52 and T2.ObjKey = T0.ItmsGrpCod
This join therefore is quite specific to how the OSPG table links to other related tables.
For a full list of object types in the database and for the DI API, you can look at the BoObjectTypes enumeration in the DI API reference in the SDK Help Center.
Hope this helps,
Owen

Similar Messages

  • Record group query question

    Just wondering if we need to check :system.mode = query or normal in the query for record groups or oracle forms handles it automatically
    Thanks

    No, you should not check System.Mode in a record group query. But then, Forms does not do that either.
    Your question makes me wonder what you are doing... Record groups are usually populated only when you need to see a list of values, or use an LOV to perform an edit.

  • Discount group

    Hi All,
    I have set item group discount using discount groups (module inventory --> price lists --> special prices --> discount groups) form but how to see the discount group result in the B1 and not using query report ? Pls give advice. TIA
    Rgd,
    Steve

    Hi Steve
    The result can only be seen when applied in an invoice. The price will be shown in blue instead of black indicating that a price other than the standard price list has been applied. i.e. a special price, etc. Unfortunately the system will not indicate which of the 3 (Period and volume, Discount Group or Special Price) was applied. This will have to be done through a query.
    Kind regards
    Peter Juby

  • Error message: deleting discount groups in WT that have been removed

    Hello,
    In the synch manager I'm getting this error:
    Deleting discount groups in WT that have been removed from B1 without notification
    The only thing I can imagine is that an Itemgroup in B1 was removed, but as far as I can remember there hasn't been removed an Itemgroup.
    The only thing which has been done in WT is that I removed a Catalog.
    Obviously I have to find out if there is an Itemgroup in WT which isn't in SBO anymore. Has anyone an idea how to find out. Probably with a query? How do I remove the Discount groups from WT?
    The problem right now is that the synch manager gives a time out error. The error of the Deleting discount groups slows down the synch by two hours which is very inconvenient in our situation (synch is normally every 10 minutes)
    Best regards,
    Tim

    SAP gave the following solution:
    Running that query indicated below in the attachment (re:Resync Special Prices posting) is a safe operation to perform. It essentially mimics someone editing every special price in SBO which forces them to synch.
    This query (and others) can be seen in a SBO stored procedure called PRX_Queue_All_Objects. Running this query and re-synching should fix the
    synch error related to there being less special pricing records in WebTools than B1.
    The other error related to discount groups is slightly more complicated.
    This is caused because the synch found that there were more discount groups in WebTools than B1 has so it is trying to delete the extra ones.
    Older versions had a problem with this step when there were many groups to delete. It was fixed in newer versions where the groups were deleted in smaller sets.
    To fix the second issue there are 2 options. First lets confirm the different in record counts.
    Run this query in B1:
    SELECT COUNT(*) FROM OSPG WHERE ObjType IN (52,43)
    And run this in WebTools
    SELECT COUNT(*) FROM PartsPricing WHERE Filter IN ('ItemGroupDiscount'
    ,'ManufacturerDiscount')
    Based on the error message, we assume there are more records in the webtools query than the B1 query.
    If they are different, there are 2 options#
    1) Delete all pricing records from WebTools, re-queue everything in SBO and re-run the synch. To do this the site should be taken offline so customers aren't browsing the site while there is no pricing information. First backup the WebTools database. Next delete everything from the partspricing table and then the partspricingmaster. Finally re-queue everything by 3 first queries in the PRX_Queue_All_Objects stored procedure. This will re-queue Discount Groups, Special Prices and
    PriceLists. If you do not have these queries as your top 3 then you have
    an older version which can be resolved by clicking the install plugin button on the synch manager. By doing this, it isn't necessary to run the query above to fix the special pricing error, it will all be handled
    in this step.
    OR
    2) Run a SQL Trace on the database which synching. This will record all sql queries running. Review the trace file after the synch stops and look for a query that is deleting from partspricing. It will probably be
    a very large SQL query with many discount group codes in the "IN"
    clause. Copy this to query analyzer and try to run directly from there.
    Once the unnecessary discount groups are removed, the synch should run much faster.
    Edited by: T. Verholt on Nov 9, 2009 12:49 PM
    Edited by: T. Verholt on Nov 9, 2009 12:50 PM

  • DTW Discount groups

    Hello
    is there a template in DTW to upload special prices based on discount groups?
    Thank you
    Edited by: Philip Eller on May 16, 2008 8:53 AM

    Hello
    Thank you for the answer but I am not sure it does answer to my question
    I have  a list of customer over 200
    The price list is properties dependant (not based on validity period or quantity) where you need to define a discount %age
    In total that makes over 600 entries so the transaction to use is discount group but I can not find a template for that...
    It seems that it is not possible via DTW ? Anyone has a solution
    Thanks
    Guillaume

  • Discount Groups DTW

    Hi Experts!
    Am I right in thinking Discount Groups Object is only available in 2007 PL09 (note 1417399)?
    If there are many many Discount Groups - is there any other way to import the Discount Groups without upgrading to PL09?
    Many thanks!
    Caroline

    Hi Caroline,
    You are right.  It is clearly mentioned Upgrade to SAP Business One 2007 A PL09 with DTW 2005 SP00 PL30 to acquire this functionality.
    For the second question, I don't think there are any other legitimate ways.
    Thanks,
    Gordon

  • What is the purpose of vendor discount groups

    Pls explain the purpose of specifing a discount group for vendor.

    Is this question for SAP Business One?
    If not, please check the following and close your thread:
    Discount Type Group
    Technical Name: 0RPA_DTG
    Use
    The discount type group is a logical summary of the discount types and is maintained in PIPE Customizing. The following are provided as standard values:
    ·        3000: Coupon
    ·        3100: Promotion discounts
    ·        3200: Membership discounts
    ·        3300: Local discounts
    ·        3400: Employee discounts
    You also have the option to define your own discount type groups here.
    This characteristic is supplied by DataSources 0RT_PA_TRAN_CONTROL and 0RT_PA_TRAN_TOTALS is filled by PIPE field DISCTYPEGROUP.
    Thanks,
    Gordon

  • Discount Groups - Items.  How to get the Buy One Get One Free discount in the Marketing Document

    Hi Experts,
    Can anyone help on this one please?...
    Under Stock Management -> Price Lists -> Special Prices -> Discount Groups -> Items -> I have selected a specific BP and then have selected a specific Item Code.  I have stated the Paid Qty as '4' and the Free Qty as '1'.
    The option 'Do Not Apply Discount Groups' is not ticked on the BP or the Item Master Data.
    There are no Special Prices for this Item for the BP.  Nor are there any period and volume discounts.
    Can anyone think of a reason why in the Sales Order I can never get the discount when putting in '3' in the Qty column on the SO please?
    Many thanks,
    Caroline

    Hi Gordon,
    Thanks for your email, and sorry for the confusion!
    I believe that when I enter '5' into the sales order the discount should come up as the Paid Qty is '4' and the Free Qty is '1'.
    Either way I can never get the discount into the Sales Order...
    Can you help please?  I was wondering if I had missed a setting somewhere or something...
    Thanks,
    Caroline

  • BBM Group Chat Question

    BBM group chat question - from time to time, additional chats show up in our group that have no messages in them. When someone posts in one, the whole group sees it and the admins can delete it, but otherwise they tend to be localized to one or two members and we can't remove them. Is there a way for a non-admin to get rid of one of these chats? My understanding is that if I had started it that I'd be able to delete it but since I'm not the creator I don't have this option. Thanks.

    Group chat is not supported yet.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Updating Discount Groups

    Hi All,
    Using the option Discount Groups for Manufacturers, when
    adding a new manufacturer, we would like to add a new discount group for it as well, for all the Business Partners. Is there any way to update the new manufactuer's discount for all the BP's but to keep the original discounts for other manufacturers?
    If we use the option 'Copy to Selection Criteria' the system will update all the manufacturer discounts and there is no way to update only the new one.
    Let's say: we would like to add a new Manufacturer to the Discount Groups of all Business Partners without having to do it manually, one by one. The "Copy to Selection Criteria" functionality cannot be used in this case, because all the Manufacturers will be copied from one Business Partner to
    the others, while we just want to copy the new Manufacturer.
    Example:
    Initial situation:
    - Discount group for Business Partner C000: Manufacturer A => 10%, manufacturer B => 5 %
    - Discount group for Business Partner C001: Manufacturer A => 20%, manufacturer B => 15 %
    - Discount group for Business Partner C002: Manufacturer B => 20%, manufacturer C => 15 %
    We want to create a new Manufacturer D, with a Discount of 30% for all Business Partners. We want to add this Manufacturer to the Discount Group of all Business
    Partners at the same time.
    If we add this Manufacturer to the Discount Group of Business Partner C000 and then use "Copy to Selection Criteria", we will get:
    - Discount group for Business Partner C000: Manufacturer A => 10%, Manufacturer B => 5%, Manufacturer D => 30%
    - Discount group for Business Partner C001: Manufacturer A => 10%, Manufacturer B => 5%, Manufacturer D => 30%
    - Discount group for Business Partner C002: Manufacturer A => 10%, Manufacturer B => 5%, Manufacturer D => 30%
    "Copy to Selection Criteria" copies all the Manufacturers and overwrite the previous information.
    Thanks and regards,
    Nat

    Hi Arun,
    It is natural that DI API updating taking times. To update 1000 DG may involve millions of transactions. You better bet is to split the numbers in different batches to achieve the same result.
    Thanks,
    Gordon

  • How to Create DI Discount Group for Customer Group?

    Hi All,
    i'm trying to create DiscountGroups for Type Customer Group in developtmnt side in sap b1. i already succed to create  Discount Group for Type Specific BP as you can see in the code i wroe below:
    di.BusinessPartners MyBP= GetBusinessObject (BoObjectTypes.oBusinessPartners) as di.BusinessPartners;
    MyBp.DiscountGroup.DiscountPercentage=20;
    but i don't succed to find the di object that give me the option to create DiscountGroup for Customer Group ( not for specific BP).
    i will very appriciate to get any help with it...
    Regards,
    Peer Shoval

    hello, maybe you could try with DI Server, if your installation allows
    that.
    try experimenting with
    -> EnhancedDiscountGroupsService Object
    SAPbobsCOM.EnhancedDiscountGroupsService dg_service = null;
                    SAPbobsCOM.EnhancedDiscountGroup dg = null;
                    SAPbobsCOM.EnhancedDiscountGroupCollectionParams collDGParams = null;
                    dg_service = (SAPbobsCOM.EnhancedDiscountGroupsService)((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany())
                                    .GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.EnhancedDiscountGroupsService);
                    collDGParams = dg_service.GetList();
                    dg = (SAPbobsCOM.EnhancedDiscountGroup)dg_service.GetDataInterface(SAPbobsCOM.EnhancedDiscountGroupsServiceDataInterfaces.edgsEnhancedDiscountGroup);
                    dg.Type  = SAPbobsCOM.DiscountGroupTypeEnum.dgt_AllBPs;
                    dg.ValidFrom = DateTime.Now;
                    dg.ValidTo = DateTime.MaxValue;
                    dg.ObjectCode = "dontknow";
                    dg.DiscountRelations = SAPbobsCOM.DiscountGroupRelationsEnum.dgrAverageDiscount;
                    //dg.DiscountGroupLineCollection.Add() //etc
                    SAPbobsCOM.EnhancedDiscountGroupParams dg_param = dg_service.Add(dg);
                    log.DebugFormat("Added discount group  {0} - {1} - {2}", dg_param.AbsEntry, dg_param.ObjectCode , dg_param.Type);

  • How to create Infoset&user group query--(query report)

    Hi Guys,
      how to create Infoset&user group query--(query report),
      Pls send me the exact procedure with Example....
                                                                              Regards:
                                                                              Kumar .G

    goto SQ03 and create an User Group If U want to create Ur Own.
    Goto SQ02 to create Ur Infoset by Giving Logical database name or Simple Database table
    Then Choose What ever data U need to be included in The Qurey in field Groups.
    Then Generate the Infoset
    Now Assign the infoset to user group
    Now goto SQ01 and Click on Other user group Button and choose Ur user Group.
    Then in the USer group select Ur Infoset and then create Ur own Query and save this.
    Now select the infoset query and goto More functions under Query menu and Generate report name.
    Now Create a transaction code for the report name generated.
    Now use the Tcode.
    Hope U have got the basic idea of creating Queries.
    ~BiSu

  • Discount Group and Special Prices

    Hello Everyone
    I have a scenario where by the discount given in both Discount Group and Special Prices needs to work in conjunction.Now at the moment if i give it in both discount group and Special Prices for BP,only Special Price discount is being picked up ie its given precedence over Discount Group.Is there any setting that i need to change to make this work.I have to show the difference in discount elsewhere,so only i need to map this in both discount group and special prices.
    Thanks and regards
    Raghu

    hi raghu ram,
    Check the wiki page in this link
    How is the default item unit price determined in marketing documents?
    https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=29524391
    Hope it will solve problem.
    Jeyakanthan

  • BAM Data Control - Group query with Active Data Service

    Trying to get a group query from a BAM data control to work with Active Data Service in an ADF application (JDeveloper 11.1.1.4.0).
    With a flat query, as the data changes, I can see DataChangeEvents fired, resulting in a data push to the client -
    <BAMDataChangeEventFilter> <log>
    #### DataChangeEvent #### on [DataControl name=CEP_Person_DOB_Flat, binding=data.view_mainPageDef.FlatDOB1.view_pageDefs_FlatDOBViewPageDef_WEB_INF_FlatDOB_xml_FlatDOB.QueryIterator]
    Filter/Collection Id : 1966
    Collection Level : 0
    Event Id : 5
    ==== DataChangeEntry (#1)
    ChangeType : INSERT_AFTER
    KeyPath : [2157, 0]
    InsertKeyPath : [null, 0]
    AttributeNames : [id, _PersonKey, _County, _Surname, _AGE, _DOB, _Country, _FirstName]
    AttributeValues : [2157, 10008/129, Vagzukarbsm, Gnnfzxxyqfgpsijcr, 110, Thu Dec 26 00:00:00 GMT 1901, Ekcqvrkoksr, Vwhm]
    When I try a group query on the same data, currently just trying to group by _DOB for every 10 years to count the number of people, I get no data change events fired, so don't get any data pushed to the client, though the data has been changed if I refresh the page.
    Any ideas ?

    can you include bam and jdev versions and also include exception from logs?

  • DTW Update Discount Group

    I have an existing Discount Group (Item Group Type).  I am trying to use DTW to add a discount percentage to an Item Group.
    I have entered values in CardCode, ObjKey and Discount. I have left LineNum blank.  It is not clear how LineNum should be used. I cannot find any documentation or Test Case example.
    The DTW run (Update mode) correctly updates the new value in the correct Item Group in the Discount List.
    BUT, it sets the discount to zero for the first displayed Item Group that had a discount before the update.
    As I type I think I may have the answer.
    OSPG only holds records that have a discount other than 0, even though the complete set of Item Groups are diisplayed on the Discount Group screen.
    So maybe what has happened is that the new record has replaced the one that is now missing.
    So does that mean that the update should use LineNum and NOT ObjKey?
    But what do you do if you have 3 item groups with a discount and you want to add two more?
    Do the new records need Line Num 3 & 4 and also obviously the Object Key.
    Sounds like a nightmare to maintain via DTW.
    Customer has 1,000 plus Item Groups.

    Tony,
    Nice to hear it. Anyway, just to inform that discount group of DTW is not available in the DTW of SAP B1 2007A SP01 PL11.
    Probably move to another BO or bugs. I am still discovering it
    JimM

Maybe you are looking for

  • Appraisal document header not showing up in the Portal

    when I look at the appraisal document in Portal ESS MSS (using WD4A application Appraisal Document) the header of the appraisal document does not show up (in PHAP_ADMIN it does). how can I show the appraisal document header in the Portal? regards, Ti

  • Strength of wireless connection

    I am a long-time Windows user that recently converted to the iMac. I still use a Windows based PC (work related). I tried setting up both a Linksys router (didn't work so I returned) and a Belkin router (it worked but the connection strength from to

  • Crop / constrain feature in iPhoto

    I'm shooting hi res 18mp images on a Canon 550d SLR in both RAW & JPEG. I understand Canon DSR's use an image aspect ratio of 3:2 which I understand (please correct me) magnifies to say 6 x4, 12 x 8, 24 x 16 etc without loss of picture area. My quest

  • Displaying timings as empty cell?

    Hi,       When i try to execute the query , the values are populating correctly. Indeed instead of timigs feilds i am getting the empty cells.                                           Until my DSO data display am getting the timigs correctly. but af

  • Mountain lion slows my computer

    Hi. I have an Imac and macbookpro. Both take much longer to startup and shutdown since I installed Mountain Lion. Is this normal? Thanks