cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member243278
Participant

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.

stefankrauth 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?

Accepted Solutions (0)

Answers (4)

Answers (4)

murthy_v
Employee
Employee

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

former_member535084
Participant
0 Kudos

malramadhan1 : I just simple use SalesPriceList.Retrieve 🙂

0 Kudos

quyennguyen : Hey, how did you get the the sales price list id to retrieve the BO? Could you please share your resolution

Thanks a lot,

Rocky

former_member535084
Participant
0 Kudos

Hello horst.schaude ,

I have problems with SalesPriceList too.

I used operator FindByTypeCodeAndPropertyIDAndPropertyValue of QuerysalespricelistinService to query discount list by BuyerID and got sucessful result.

Here my request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global">
   <soapenv:Header/>
   <soapenv:Body>
      <glob:SalesPriceListFindByTypeCodeAndPropertyIDAndPropertyValueQuery_sync>
         <SalesPriceList>
            <TypeCode>7PL2</TypeCode>
          
            <PropertyValuationPriceSpecificationElementPropertyValuation1>
               <IdentifyingIndicator>true</IdentifyingIndicator>
               <PriceSpecificationElementPropertyReference>
                  <PriceSpecificationElementPropertyID>CND_BUYER_ID</PriceSpecificationElementPropertyID>
               </PriceSpecificationElementPropertyReference>
               <PriceSpecificationElementPropertyValue>
                  <ID>CP100110</ID>
           
               </PriceSpecificationElementPropertyValue>
            </PropertyValuationPriceSpecificationElementPropertyValuation1>
         </SalesPriceList>
      </glob:SalesPriceListFindByTypeCodeAndPropertyIDAndPropertyValueQuery_sync>
   </soapenv:Body>
</soapenv:Envelope>

But when I used ASBL code to query qith same input, I cannot get any result 😞

Here my code

var salePriceQuery = SalesPriceList.QueryByTypeCodeAndPropertyIDAndPropertyValue;
var paramsSalesPrice = salePriceQuery.CreateSelectionParams();
paramsSalesPrice.Add(salePriceQuery.TypeCode.content,"I","EQ","7PL2");
paramsSalesPrice.Add(salePriceQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content,"I","EQ","CND_BUYER_ID");
paramsSalesPrice.Add(salePriceQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content,"I","EQ","CP100110");
var result = salePriceQuery.Execute(paramsSalesPrice);

Would you please give me some ideas about this ?

Thanks a lot!

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Quyen,

You showed the request, but what was the response?

Bye,
. Horst

former_member535084
Participant
0 Kudos

I resolved this issue, Thank Horst Schaude for your response.

I have other question:

1. I try to query SalesPrice with 2 group codes at the same time. Is that possible ?

Do you know any way to use Price list and Discount list in same time ?

2. Can I add UDF (user defined field) for Items of Product Catalog ?

Many thanks!

Quyen

former_member606838
Participant

quyennguyen

Do you mine sharing how you solved it?

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Barış,

The responsible colleague will provide an answer. 🙂

Bye,
. Horst

former_member243278
Participant
0 Kudos

Hi Horst,

We are waiting for 2 days. Who is responsible person for this issue? Can you please share with me?

We have a deadline for development, so we have to handle the problem as soon as possible.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Barış,

I've contacted murthy.v again and asked for some response.

HTH,
. Horst