cancel
Showing results for 
Search instead for 
Did you mean: 

Query Procurement Price Specification by Product ID

Former Member
0 Kudos

Dear community,

I would like to query procurement price specificaiton by a productID. I tried to do this with this code:

var priceSpecQuery = ProcurementPriceSpecification.QueryByTypeCodeAndPropertyIDAndPropertyValue;

var params = priceSpecQuery.CreateSelectionParams();

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

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

var result = priceSpecQuery.Execute(params);

if(result.Count() >0)

{

    var resultLine = result.GetFirst();

    this.PurchasingPrice = resultLine.Amount;

}

There is no result, even thought there is a price specified for the Service Product "Test123".

Can you help me with that?

Kind regards,

Christine Toblier

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello to everyone,

I finally was able to query for price specifications. I had to use at least three property valuation query params in order to get a result.

Here is an example, that worked:

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", "TEST-123"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_SUPPL_ID"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation2.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "10002"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_PRD_CAT_ID"); params.Add(priceSpecQuery.PropertyValuationPriceSpecificationElementPropertyValuation3.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "10");

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

var result = priceSpecQuery.Execute(params);

former_member200567
Active Contributor
0 Kudos

Hi Christine,

I am getting this error when I call Execute() method.

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

Best Regards,

Fredd

former_member275924
Active Participant
0 Kudos

Hello Christine ,

I tried to get the query of ProcurementPriceSpecification this with this code .

I change the PropertyValuationPriceSpecificationElementPropertyValuation [No] like the query result of repository. eg: [No] : 1 or 4 or 3...

But I can't

****************************************************************************************

var prodID = this.ProductKey.ProductID.content;

  if(!prodID.IsInitial()){

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

  var prd_cat = this.ProductCategory.InternalID;

  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", prodID);

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

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

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

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

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.ToParent.ListUnitPrice.Amount.content = inst.Amount.content;

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

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

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

}

  }

*******************************************************************************************************

Best Regards,

Pole

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Christine,

I do not know about the Query you are using, but maybe this is helpfull:

From my experience, with some queries for standard objects you have to set specific parameters to get the results.

If you leave these "required" parameters empty, the queries with this behaviour will show no content or even throw errors.

As a general hint, try to set the fields given by the name of the query, i.e. in this case try to set a type code, a property ID and a Property value to get some results. If successfull, try to reduce the parameters set to determine, which query parameters are mandatory and which not.

And: No, I do not know why some queries behave like this.

Best regards,

Ludger

--

Custom Development with All4Cloud.de

Former Member
0 Kudos

Hi Ludger,

thanks for the hint!

Regretably this does not seem to solve the problem. I still get no result, even when i use all the available query parameters.

Kind regards,

Christine