Skip to Content
avatar image
Former Member

Conditional Summation in VC Object Dependency

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 06, 2015 at 05:57 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Jun 05, 2015 at 04:43 PM

    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

    Add comment
    10|10000 characters needed characters exceeded