Skip to Content
author's profile photo
Former Member

Update rule with Key Figure value nil with 0COPC_O01

I have a problem with update rules. I am using ODS 0COPC_O01 and after the update, the field 0PRICE_VAL is nil. The simulation of the update is as follows:

Comm Structure

Company Code Plant Material Price Control Price Type Material Price

1000 1100 2 S P01 30.35

1000 1100 2 S P02 30.37

1000 1100 2 S P01 30.35

1000 1100 2 S P02 1.00

Data Target View

Company Code Plant Material Price Control Valuation

1000 1100 2 S 0.00

1000 1100 2 S 0.00

The update rule contains the following code for Valuation:

if ( COMM_STRUCTURE-PRICE_CTRL = 'S' and

COMM_STRUCTURE-PRICE_type = 'P01' ) or

( COMM_STRUCTURE-PRICE_CTRL = 'V' and

COMM_STRUCTURE-PRICE_type = 'P02' ).

RESULT = COMM_STRUCTURE-price_mat.

Endif.

If I load a single entry, the price loads correct, but as soon as more than one entry is loaded, I get the 0.00 in valuation.

Any help would be appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • author's profile photo
    Former Member
    Posted on Apr 25, 2007 at 02:51 PM

    Hi,

    this seems that logic is wrong.

    may be you can split the code using two IF statements.

    first statement for checking and updating S price.

    second for checking and updating V price.

    Regards,

    Vishwa.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Oct 15, 2009 at 03:14 PM

    Hi All,

    I wanted to post the answer to this problem more than two years later, just in case someone else have this particular problem.

    The logic of the IF statement is correct, the problem is that the key of the DSO does not contain price control or price type, so when the routine gets records like in your example:

    Comm Structure

    Company Code Plant Material Price Control Price Type Material Price

    1000 1100 2 S P01 30.35 <--- here the IF enters correctly, so the result record will be 1000 1100 2 S 30.35

    1000 1100 2 S P02 30.37 <----in this one the IF condition is not met, and updates the same (above) key with 0

    1000 1100 2 S P01 30.35 <--- same case with these records.

    1000 1100 2 S P02 1.00

    These is correct because when the price control is equal to S it means its going to take the standard price, which is the price type P01, and the P02 price type is taken when the price control of the material is set to V (Moving average price/periodic unit price).

    What you can do here is make a start routine to remove the bad records or extend the key of the DSO.

    Hope this helps someone.

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Oct 15, 2009 at 03:14 PM

    Hi All,

    I wanted to post the answer to this problem more than two years later, just in case someone else have this particular problem.

    The logic of the IF statement is correct, the problem is that the key of the DSO does not contain price control or price type, so when the routine gets records like in your example:

    Comm Structure

    Company Code Plant Material Price Control Price Type Material Price

    1000 1100 2 S P01 30.35 <--- here the IF enters correctly, so the result record will be 1000 1100 2 S 30.35

    1000 1100 2 S P02 30.37 <----in this one the IF condition is not met, and updates the same (above) key with 0

    1000 1100 2 S P01 30.35 <--- same case with these records.

    1000 1100 2 S P02 1.00

    These is correct because when the price control is equal to S it means its going to take the standard price, which is the price type P01, and the P02 price type is taken when the price control of the material is set to V (Moving average price/periodic unit price).

    What you can do here is make a start routine to remove the bad records or extend the key of the DSO.

    Hope this helps someone.

    Regards

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Agree, the key of the ODS is not correct.

      O changed the Key to include also the Price Type (0PRICE_TYPE) and 0STLMT_CTRL.

      Maybe is a good idea to clean null prices in the start routine.