RE:[sap-log-sd] Pricing Condition to if All Material Line Items meet Criteria

Posted by Mike (President)
on Nov 22 at 9:44 PM
Ruby - you shouldn't use a requirement for this. Requirements are only fired during the initial pricing process. Your trigger should be a statistical group condition with an assigned working subtotal field (like D). What I have done in the past is have create a flag field in the TKOMP structure. I have usually used a condition table / type that is not in the pricing procedure to hold the data - but that is simply because pricing condition maintenance is automatically generated. This condition record maintains (in your case), the level 2 values that should get freight. In the TKOMP exit, I would use the level2 field to read the condition table. If a record is found, set your flag field to a value, say FR; if a record is not found, set it to NF. Create a scale formula that you will assign to your statistical group condition. The formula logic sets the scale basis to 0 whenever the KOMP field is FR and 1 when the value is NF. Then create your group condition record with the grouping value based on NF so that the scale starts with 1. Finally, have a formula assigned to your real freight condition. If the value of SUBTOTAL D is <> 0 (because the statistical group condition found a record), then set the freight condition to inactive and 0. By using a group condition, your logic is reprocessed for all materials whenever there is a change.
The key to this logic is the scale formula that converts the scale basis to effectively a counter based on a value for each material. Only if all of the materials on the order have a freight flag of FR, will the freight be calculated. If one material has a value of NF, then the freight calculation will be zeroed out and deactivated.
Mike

---------------Original Message---------------
From: rubitoncek
Sent: Monday, November 21, 2011 1:22 PM
Subject: Pricing Condition to if All Material Line Items meet Criteria

Hi Experts,
My client has a requirement to pick a header freight pricing condition (header group condition) only if all the materials in the sales order have a particular Level 2 product Hierarchy. If at least 1 line item in the sales order does not have the required product hierarchy the system will not calculate freight. A requirement routine has been created to check line items in the sales order . The following code was introduced to the routine to dynamically check the material line items while creating the sales order:

lc_xvbap(17) type c value '(SAPMV45A)XVBAP[ ]' and the program loops through this table to check the line item product hierarchy and see if it is applicable for freight.

Problem with this code is that when the user deletes a line item and changes it for another material then (SAPMV45A)XVBAP[ ] does not get refreshed automatically unless the order is saved. This means that order can look as if freight has been picked incorrectly. Is there a way to ensure SAPMV45A)XVBAP[ ] is refreshed straight away?

Many Thanks
Ruby

__.____._
Copyright © 2011 Toolbox.com and message author.

Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251
Mark as helpful
View this online
  
Mike
SAP Logistics Sales and Distribution Enthusiast

Contributed 100 posts in a group to earn a Bronze Achievement
Popular White Papers

In the Spotlight
Have an SAP Question? Ask Your Peers at Toolbox for IT

_.____.__