Skip to Content

How to query DiscountList on overall customer discounts in SAP C4C?

Hi everyone,

I am trying to query on overall customer discount list on the system. I created a discount list under the products for my specific customers. Everything is working fine so far. However, I want to read or query the discount list for my customer in .absl. I could not find a business object.

I just found below standard BO;

  1. SalesPriceList
  2. SalesPriceSpecification
  3. PriceSpecification

But when I try to query for these BOs, it returns weird data which does not have an UUID or ID. Lots of times, it was not returning data, it caused directly short dump. I also found some topics which Horst Schaude answered on community. However, I could not find a solution.

Stefan Hagen do you have any comment on this issue?

I also tried to query from repository explorer as well as from .absl event. Result was same in both.

Any recommendation?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 20, 2017 at 10:03 AM

    Hello Barış,

    The responsible colleague will provide an answer. :-)

    Bye,
    . Horst

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 27, 2017 at 04:15 AM

    Business Context and Use

    ==========================

    The Sales Price List business object is used to simplify the mass maintenance of product based prices, customer discounts, and so on. The Sales Price List business object is specified for a combination of properties (for example a sales organisation, distribution channel, customer, a purchaser and so on), and is valid for a specific time period (for example a year).

    Structure Overview

    ===================

    A SalesPriceList contains header information, such as the identifier, the type of representation, the maximum possible properties, and the validity period of a list. A SalesPriceList also contains common properties of all specifications with their assigned values, the default values for the individual specifications, and the list of specifications.

    Sample use case with ABSL example:

    ===================================

    The action ReadPrices first performs the initialization query (QueryByGroupCode) for the sales price list and then queries the valid price list by the definded property valuations on price list header and item.

    import AP.FO.PriceAndTax.Global;

    import AP.Common.GDT;

    var priceList : BusinessObject::SalesPriceList;

    var price : BusinessObject::SalesPriceList.PriceSpecification;

    var propertyValuation : BusinessObject::SalesPriceList.PriceSpecification.PropertyValuation;

    var productPrices : elementsof BasePriceList.ProductPrices; // Initialization query to define Workcenter subview, e.g. PriceList

    var initQuery = SalesPriceList.QueryByGroupCode;

    var initSelParams = initQuery.CreateSelectionParams();

    // Step 1: initialize price list ( same BO is used as Price or Discount List ) , initialization is mandatory step before using the BO

    // Initialization for all Net Prices List : PLPRICE1

    // Initialization for all Gross Prices List : PLPRICE1GR

    // Initialization for all Net Discount List : PLDISC1

    // Initialization for all Gross Discount List : PLDISC1GR

    // Initialization for all Prices Lists and Discount List : PLALL1

    initSelParams.Add(initQuery.GroupCode.content, "I", "EQ", "PLPRICE1");

    var initQueryResult = initQuery.Execute(initSelParams); // Initialize Price or Discount List

    //Step 2: fill all selection parameters of query

    var query = SalesPriceList.QueryByTypeCodeAndPropertyIDAndPropertyValue;

    var selParams = query.CreateSelectionParams(); // List type 7PL0 = Price inside a list

    // Note : Discount List initialization

    //Overall Customer Discount = 7PL1

    //Overall Customer Group Discount = 7PL3

    // Customer Hierarchy Specific Discount List = 7PL1

    //Customer Specific Discount Products = 7PL2

    //Customer Specific Discount Product Category = 7PL4

    //Customer Hierarchy Specific Discount Product Category = 7PL3

    selParams.Add(query.TypeCode.content, "I", "EQ", "7PL0"); // Released price list

    selParams.Add(query.ReleaseStatusCode, "I", "EQ", "3" ); // Valid today

    selParams.Add(query.ValidityPeriod.StartTimePoint.Date, "I", "EQ", Context.GetCurrentUserDate());

    selParams.Add(query.ValidityPeriod.EndTimePoint.Date, "I", "EQ", Context.GetCurrentUserDate()); // Base price list has no header fields (= PropertyValuation), but four item fields (= PriceSpecificationPropertyValuation1-4) selParams.Add(query.PriceSpecificationPropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID"); selParams.Add(query.PriceSpecificationPropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID_TYPE_CODE"); selParams.Add(query.PriceSpecificationPropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_TYPE_CODE"); selParams.Add(query.PriceSpecificationPropertyValuationPriceSpecificationElementPropertyValuation4.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "PRC_PRICE_LIST"); // The query should return only one price list (due to defined query parameters)!

    // Step 3 : Execute Query

    var queryResult = query.Execute(selParams);

    // Step 4 : Read Item instances of price or discount list

    foreach (priceList in queryResult) {

    this.Id = priceList.ID; foreach (price in priceList.PriceSpecification) {

    foreach (propertyValuation in price.PropertyValuation) {

    if (propertyValuation.PriceSpecificationElementPropertyValuation.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content == "CND_PRODUCT_ID" ) {

    productPrices.Product.content = propertyValuation.PriceSpecificationElementPropertyValuation.PriceSpecificationElementPropertyValue.ID.content; break;

    }

    }

    productPrices.Price.Amount = price.Amount;

    productPrices.Price.BaseQuantity = price.BaseQuantity;

    productPrices.Price.BaseQuantityTypeCode = price.BaseQuantityTypeCode;

    this.ProductPrices.Create(productPrices);

    }

    }

    Note : Price / Discount List initialization details. Example TypeCode.content parameters

    Base Price List 7PL0

    Base Price List (Gross) 8PL0

    Base Price List by Product Category 7PL0

    Base Price List by Product Category (Gross) 8PL0

    Distribution Chain Price List 7PL0

    Distribution Chain Price List (Gross) 8PL0

    Distribution Chain Price List by Product Category 7PL0

    Distribution Chain Price List by Product Category (Gross) 8PL0

    Customer Group Specific Price List 7PL0

    Customer Group Specific Price List (Gross) 8PL0

    Customer Specific Price List 7PL0

    Customer Specific Price List (Gross) 8PL0

    Overall Customer Discount 7PL1

    Overall Customer Discount (Gross) 8PL1

    Overall Customer Group Discount 7PL3

    Overall Customer Group Discount (Gross) 8PL3

    Customer Specific Discount Products 7PL2

    Customer Specific Discount Products (Gross) 8PL2

    Customer Specific Discount Product Category 7PL4

    Customer Specific Discount Product Category (Gross) 8PL4

    Customer Hierarchy Specific Discount List 7PL1

    Customer Hierarchy Specific Discount List(Gross) 8PL1

    Base Price List by Product Category with Evaluation 7PL0

    Base Price List by Product Category with Evaluation (Gross) 8PL0

    Customer Hierarchy Specific Discount Product Category 7PL3

    Customer Hierarchy Specific Discount Product Category(Gross) 8PL3

    Campaign Specific Price List 7PL0

    Company specific Price List 7PL0

    Add comment
    10|10000 characters needed characters exceeded