Skip to Content
0

Query SalesPriceList multiple times with different GroupCode

Dec 16, 2016 at 08:46 AM

115

avatar image

Dear community,

as I am working with products in my solution for a customer, I need to query the BO SalesPriceList, as prices and discounts are held by this business object.

I know that I need to execute an init-query beforehand (it is not clear to me why, but anyways...), e.g. to query sales price lists:

var initQuery = SalesPriceList.QueryByGroupCode;   
var initSelParams = initQuery.CreateSelectionParams();   
initSelParams.Add(initQuery.GroupCode.content, "I", "EQ", "PLPRICE1");
var initQueryResult = initQuery.Execute(initSelParams);

And then I do my query on the SalesPriceList.QueryByTypeCodeAndPropertyIDAndPropertyValue and set my selection parameters - which works fine and as expected.

Now I need to query for discount lists in the same event (AfterModify), and since discount lists are of a different group code, I need to redo the init-query (otherwise it will still just find sales price lists again):

var initQueryDiscount = SalesPriceList.QueryByGroupCode;
var initSelParamsDiscount = initQueryDiscount.CreateSelectionParams();
initSelParamsDiscount.Add(initQueryDiscount.GroupCode.content, "I", "EQ", "PLDISC1");
var initQueryResultDiscount = initQueryDiscount.Execute(initSelParamsDiscount);

But somehow I am not able to change the init-query, since the following errors get thrown when I use the debugger (these errors will not show on the UI):

(PRC_SALES_PRICE_LIST, ROOT) A technical error (Changing condition maintenance group not possible) occurred: PRC_ESF_CND_MAINT 505. Report an incident.

(PRC_SALES_PRICE_LIST, PriceSpecification.ROOT) A technical error (Changing condition maintenance group not possible) occurred: PRC_ESF_CND_MAINT 505. Report an incident.

Without this re-init-query I am just finding sales price lists again.

Unfortunately these use-cases and the BO/query themselves are very poorly documented, so can anyone help me with this problem?

Thanks in advance and best regards,

Jürgen

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Pradeep Kumar N
Dec 17, 2016 at 03:44 AM
0

Hi Jurgen,

Execute the query only once by adding both the selection parameters:

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

and in the result check for the GroupCode.

Thanks, Pradeep.

Share
10 |10000 characters needed characters left characters exceeded