cancel
Showing results for 
Search instead for 
Did you mean: 

updating other line items when changing item value (ABAP Cloud, BTP, RAP)

sebastian_wilhelm1
Participant
0 Kudos

Hi experts! 

when changing a line item value (e.g. item1-quantity) of a Business Object, I need to calculate another value for all line items (e.g.e Item1-price and Item2-price) and update all line items.

IDQuantityPrice
Item12 PC11,90 €
Item22 PC8,80 €

the calculation works fine but the new value of item2-price won't be displayed.

I created a determination in the Item (Child) BDEF.

 

  determination calculatePrice on modify { field Quantity; }
  side effects
   { field Quantity affects field Price; }

 

and the Implementation looks like

 

...some calculation... 
MODIFY ENTITIES OF zr_test IN LOCAL MODE
      ENTITY Item
        UPDATE FIELDS ( Price )
        WITH VALUE #( FOR item IN items INDEX INTO i
                      ( %tky              = item-%tky
                        Price          = item-Price ) ).

 

It seems that the side effect only works for the changed item1 but doesn't effect the values of other entities.

Does anyone know how to solve this issue?

Thanks and regards, Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

MaryiaLakevich
Advisor
Advisor

Hi Sebastian,

You can use the following side effect to refresh only a specific column for all items:

  side effects
  {
    field Quantity affects field _Header._Item.Price;
  }

 Item Side Effect Specific Column.gif

Best Regards,

Maryia

Answers (1)

Answers (1)

MaryiaLakevich
Advisor
Advisor

 Hi Sebastian,

You can try to change your side effect for the Item entity to the following:

  side effects
  {
    field Quantity affects entity _Header._Item;
  }

 All items will be refreshed after changing the Quantity for Item.

Item Side Effect.gif 

Best Regards,

Maryia

sebastian_wilhelm1
Participant
0 Kudos
Thanks @MaryiaLakevich! That works fine