on 2023 May 25 2:08 PM
Hi Expert:
I am using RAP to build my own fiori application.
My application needs to recalculate the amount field on the header when changing the amount of line items,
So I use side effects to implement my functions.
However, when I modified the amount of the line item and clicked the save button,
The system prompts that an error has occurred and I need to refresh the data.
side effects
{
field Amount
affects field _POPaymentPrg . ClearPrepaidAmount, field _POPaymentPrg . OutstandingAmount,
field _POPaymentPrg . prepaidamount, field _POPaymentPrg . InvoicePaymentAmount,
field _POPaymentPrg . paidamount, field _POPaymentPrg . RemainingAmount,
field _POPaymentPrg . PogressStatus, messages;
}
determination CalculateAmount on modify { field Amount;}
METHOD CalculateAmount.
READ ENTITIES OF zi_popaymentprg IN LOCAL MODE
ENTITY advpayapply
BY \_popaymentprg
FIELDS ( orderuuid )
WITH CORRESPONDING #( keys )
RESULT DATA(lt_travels).
"update involved instances
MODIFY ENTITIES OF zi_popaymentprg IN LOCAL MODE
ENTITY popaymentprg
EXECUTE recalctotalprice
FROM VALUE #( FOR <fs_key> IN lt_travels ( %tky = <fs_key>-%tky ) ).
ENDMETHOD.
METHOD ReCalcTotalPrice.
DATA update TYPE TABLE FOR UPDATE zi_popaymentprg\\popaymentprg.
DATA lt_advpaymentAmount TYPE zi_advpayapply-Amount.
READ ENTITIES OF zi_popaymentprg IN LOCAL MODE
ENTITY popaymentprg
ALL FIELDS
WITH CORRESPONDING #( keys )
RESULT DATA(lt_popayments).
LOOP AT lt_popayments ASSIGNING FIELD-SYMBOL(<Fs_popayment>).
READ ENTITIES OF zi_popaymentprg IN LOCAL MODE
ENTITY popaymentprg
BY \_AdvPayApply
ALL FIELDS
WITH VALUE #( ( %tky = <Fs_popayment>-%tky ) )
RESULT DATA(lt_advancdPayments).
LOOP AT lt_advancdPayments INTO DATA(lt_advancdPayment).
lt_advpaymentAmount += lt_advancdPayment-Amount.
ENDLOOP.
APPEND VALUE #( %tky = <Fs_popayment>-%tky
prepaidamount = lt_advpaymentAmount
) TO update.
ENDLOOP.
MODIFY ENTITIES OF zi_popaymentprg IN LOCAL MODE
ENTITY popaymentprg
UPDATE FIELDS ( prepaidamount )
WITH update.
ENDMETHOD.
I would greatly appreciate it if you could help me solve this problem.
Hi Jiangwei,
this error message comes up if you do not maintain side effects in your projection behavior definition. Just like other behavior, side effects must be reused for consumption in the projection BDEF with the syntax
use side effects
Please check ABAP RESTful Application Programming Model - Side Effects or Developing side effects for further information.
Should this not be the problem in your implementation, please provide further details.
Best regards,
Marina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
7 | |
7 | |
6 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.