Skip to Content

Query Procurement Price Specification by Product ID

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 06, 2015 at 02:04 PM

    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);

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2015 at 04:17 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.