cancel
Showing results for 
Search instead for 
Did you mean: 

Query does not work in Procurement Price Specification

former_member275924
Active Participant
0 Kudos

Hi experts ,

I want to get the data of List Price of Product Portfolio using absl to overwrite the price of purchase order .

I thinks the BO of List Price is "ProcurementPriceSpecification" .

In reporsitory , I execute the data by using query "QueryByTypeCodeAndPropertyIDAndPropertyValue" .

Although I add right paramter , the result was zero .

I use some code to query "ProcurementPriceSpecification" BO.

The result also zero . So, I trace my code , I am getting the error

" (PRC_PROCUREMENT_PS, ROOT) A technical error (No business configuration to process request) occurred: PRC_ESF_CND_MAINT 109. Report an incident."

I also reference the discussion "Query Procurement Price Specification by Product ID".

I tried to do this with this code:

import ABSL;

import AP.FO.PriceAndTax.Global;

////////////////

if(this.ItemProduct.IsSet()){

   var prodID = this.ItemProduct.ProductKey.ProductID.content;

   if(!prodID.IsInitial()){

  

   var TestDate = Date.ParseFromString("20160605");

   var supplier  = this.ToParent.SellerParty.Party.Key.PartyID.content;

   var prd_cat = this.ItemProduct.ProductCategory.InternalID;

   if(!TestDate.IsInitial()){

   var priceSpecQuery = ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue;

   var params = priceSpecQuery.CreateSelectionParams();

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", prodID);

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", supplier);

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ",prd_cat);

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID");

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_SUPPL_ID");

   params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_ID");

   params.Add(priceSpecQuery.Status.ConsistencyStatusCode, "I", "EQ", "3");

   params.Add(priceSpecQuery.Status.ReleaseStatusCode , "I", "EQ", "3");

   var result = priceSpecQuery.Execute(params);

   foreach(var inst in result){

   this.ListUnitPrice.Amount.content = inst.Amount.content;

   this.ListUnitPrice.Amount.currencyCode = inst.Amount.currencyCode;

   this.ListUnitPrice.BaseQuantity.content = inst.BaseQuantity.content;

   this.ListUnitPrice.BaseQuantityTypeCode.content = inst.BaseQuantityTypeCode.content;

   }

   }

   }

}

Best Regards,

Phyo

View Entire Topic
dominik_g
Participant

Hi there,

var priceList : BusinessObject::ProcurementPriceSpecification;
var propertyValuation : BusinessObject::ProcurementPriceSpecification.PropertyValuation;
/*
//Bin mir nicht sicher ob dise Init Query benötigt wird
// Initialization query to define Workcenter subview, e.g. PriceList
var initQuery = ProcurementPriceSpecification.QueryByGroupCode;
var initSelParams = initQuery.CreateSelectionParams();
initSelParams.Add(initQuery.GroupCode.content, "I", "EQ", "SRM_PPS");
var initQueryResult = initQuery.Execute(initSelParams);
*/
//Fetch Purchase Price from Procuremend price List
var priceSpecQuery = ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue;
var params = priceSpecQuery.CreateSelectionParams();
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", productID); //INSERT PRODUCT NUMBER
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_SUPPL_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", supplierId); //INSERT supplier ID
 
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_TYPE_CODE");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "1"); //mandatory technical field ( 1 represents Material )
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation4.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRODUCT_ID_TYPE_CODE");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation4.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "1"); //mandatory technical field
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation5.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation6.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_HIER_ID");
params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation7.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_COMPANY_ID");
//search for current validity date
params.Add(priceSpecQuery.ValidityPeriod.StartTimePoint.Date, "I", "LE", Context.GetCurrentUserDate()); // Current Date
params.Add(priceSpecQuery.ValidityPeriod.StartTimePoint.TypeCode, "I", "EQ", "1"); //mandatory technical field
params.Add(priceSpecQuery.ValidityPeriod.EndTimePoint.Date, "I", "GE", Context.GetCurrentUserDate()); // Current Date
params.Add(priceSpecQuery.ValidityPeriod.EndTimePoint.TypeCode, "I", "EQ", "1"); //mandatory technical field
params.Add(priceSpecQuery.Status.ConsistencyStatusCode, "I", "EQ", "3");
params.Add(priceSpecQuery.Status.ReleaseStatusCode, "I", "EQ", "3");
//01PP => List Price
params.Add(priceSpecQuery.TypeCode.content, "I", "EQ", "01PP");
var result = priceSpecQuery.Execute(params);
óespinar
Participant

This code works perfectly.

Thanks!

planteksz
Explorer
This is exactly what I needed! This code works perfectly, thank you so much. I tried doing it with only half of these parameters but all of these had to be added.
dominik_g
Participant
0 Kudos
I'm glad that the post helped you even though that it is so old :):)