cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Summation in VC Object Dependency

Former Member
0 Kudos

Hi All,

My material has 12 parameters, each of which has a VC characteristic for colour & a characteristic for %age.

I need to populate the value of another characteristic, %total, summing the individual %age(s) dependent on their colour, e.g.

%total =

%age_1 IF colour_1 in ('red', 'white', 'blue')

+

%age_2 IF colour_2 in ('red', 'white', 'blue')

+

........

+

%age_12 IF colour_12 in ('red', 'white', 'blue')


When I try this in an O.D. the syntax errors after the first IF condition.

Is there a way to do the conditional summation or do I need to create 12 new characteristics to hold each condition then sum the results with another O.D.?


Thanks

Accepted Solutions (1)

Accepted Solutions (1)

ravi_kumar204
Active Participant
0 Kudos

Hi Ian,

Generally Condition (IF) should be ended with a "comma" if further conditions are required in the dependency.

To achieve the age total, try with below code in procedure.

%total = %age_1

IF colour_1 in ('red', 'white', 'blue'),

%total = %total + %age_2

IF colour_2 in ('red', 'white', 'blue'),

%total = %total + %age_3

IF colour_3 in ('red', 'white', 'blue'),

+,

........,

+,

%total = %total + %age_122

IF colour_12 in ('red', 'white', 'blue').

Thanks,

Ravikumar B.

Former Member
0 Kudos

Hi Ravi, many thanks for your assistance.

Your code has given me what is required (I was missing the second "%total" in the expression %total = %total + .........

Thanks again,

Ian

Answers (1)

Answers (1)

former_member193808
Active Contributor
0 Kudos

Hi,

Did you check what's the error?

I doubt the %age_X has some issue. Also, when you have multiple lines under same condition, comma will be required.

You can refer creation of the object dependency processing by procedures in the below link :

Processing Sequence of Procedures - Variant Configuration (LO-VC) - SAP Library

Thanks

Prem