cancel
Showing results for 
Search instead for 
Did you mean: 

How to query the Company Specific Price List?

óespinar
Participant
0 Kudos

Hello everyone,

I need to query the Price List by CompanyID and ProductID (Company specific Price List show option) from ABSL.

I'm trying to use QueryByTypeCodeAndPropertyIDAndPropertyValue into SalesPriceList BO, but no information about how to use it and how to configure the Query parameters for this search.

I have already trying to query using the Inbound Service QuerySalesPriceListIn in which sometimes there is more information available, but with the same result.

Does anyone have experience on how to get this kind of price list?

Thanks in advance for your help!

Óscar


Accepted Solutions (1)

Accepted Solutions (1)

óespinar
Participant
In case anyone runs into the same problem ...
Cheers,

Óscar


// Init Query

var initQuery = SalesPriceList.QueryByGroupCode;

var initSelParams = initQuery.CreateSelectionParams();

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

var initQueryResult = initQuery.Execute(initSelParams);

// Query base price list

var query = SalesPriceList.QueryByTypeCodeAndPropertyIDAndPropertyValue;

var selParams = query.CreateSelectionParams();

selParams.Add(query.TypeCode.content, "I", "EQ", "7PL0");

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

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

selParams.Add(query.ValidityPeriod.EndTimePoint.Date, "I", "GE", Context.GetCurrentUserDate());

selParams.Add(query.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content, "I", "EQ", "CND_COMPANY_ID");

selParams.Add(query.PropertyValuationPriceSpecificationElementPropertyValuation1.PriceSpecificationElementPropertyValue.ID.content, "I", "EQ", "YourCompanyID");

var queryResult = query.Execute(selParams);

foreach (var priceList in queryResult)

{

  foreach (var price in priceList.PriceSpecification)

  {

        foreach(var _valuation in price.PropertyValuation)

        {

if(_valuation.PriceSpecificationElementPropertyValuation.PriceSpecificationElementPropertyReference.PriceSpecificationElementPropertyID.content == "CND_PRODUCT_ID" &&

            _valuation.PriceSpecificationElementPropertyValuation.PriceSpecificationElementPropertyValue.ID.content == "YourProductID")

            {

                productPrices.Product = "YourProductID";

                break;

             }

        }

        productPrices.Price.Amount = price.Amount;

        productPrices.Price.BaseQuantity = price.BaseQuantity;

        productPrices.Price.BaseQuantityTypeCode = price.BaseQuantityTypeCode;

        this.ProductPrices.Create(productPrices);

        break;

  }

}

Former Member
0 Kudos

Thank You for this ... Do you know if the ability to update that PriceSpecification on the SalesPriceList exists?  it Appears you can via the inbound serviced (not tested yet) but not in the ABSL.. I just want to verify

óespinar
Participant
0 Kudos

Hi William,

SalesPriceList BO and PriceSpecification node have no Write Access in the PSM, so you can't update using absl code.

You could try using the InboundService (I've never used) or via Internal Communication from your BO to the SalesPriceList.PriceSpecification node.

Cheers,

Óscar.

former_member195790
Participant
0 Kudos

Hi Óscar



Please tell me  Where is the place to put your script above?


Should I put  it  in action script  file from custom business object ?



Best Regards,


Krit R.





óespinar
Participant
0 Kudos

Hello Krit,

This is a standard action script code, so you could put it into any action of your BO (or BO Extension), into Event-BeforeSave.absl, Event-AfterModify.absl, etc...

Regards,

Óscar

former_member195790
Participant
0 Kudos

Thanks Óscar



Could you please guide me for my requirements?



I want to create search page that allow users to input CustomerID or ProductID as criteria for searching.


If CustomerID is specified by users then I will use that CustomerID to query and get CustomerGroupCode.


After that I will use that CustomerGroupCode to query SalesPriceList and then display the results in table.


In this case I didn't create any custom BO. 



How can I use your code ?   (Your code snippet is exactly what I need, but I don't know where to use it   )



Best Regards,


Krit R.

óespinar
Participant
0 Kudos

Hello Krit,

I guess you will have to create a small AddOn  with a custom BO and some screens with buttons (actions) that will make the reading you need based on your parameters.

Maybe you could create a Report using a custom or standard DataSource containing the PriceList information and filtering by some field like CustomerID.

Regards,

Óscar

Former Member
0 Kudos

Hi Óscar,

could you please explain how to create a custom DataSource that shows all PriceLists?

In the standard I can't find a DataSource that contains the PriceList data and have trouble doing so.

Thanks a lot,

Ludger

Answers (0)