2024 Jun 05 4:16 PM - edited 2024 Jun 06 7:14 AM
I have a business use case in which an enduser selects one or more sales orders in a custom app and presses an action to allocate them to another department.
In this allocation process the selected sales orders need to be modified in the backend.
My backend is a RAP-based OData v2 service with an action to allocate the sales orders an modify them:
action AfterSalesAllocate result [1..*] $self;
In my action implementation i am modifying the sales orders via EML and trying to commit the changes:
LOOP AT lt_aggr_ic_so ASSIGNING <ls_aggr_ic_so>.
MODIFY ENTITIES OF r_salesordertp
ENTITY salesorderitem
EXECUTE removebillingblock
FROM VALUE #( ( %key-salesorder = <ls_aggr_ic_so>-receivingreturnorder
%key-salesorderitem = <ls_aggr_ic_so>-receivingreturnitem ) )
" TODO: variable is assigned but never used (ABAP cleaner)
FAILED DATA(ls_failed_removebillingblock)
" TODO: variable is assigned but never used (ABAP cleaner)
REPORTED DATA(ls_reported_removebillingblock).
MODIFY ENTITIES OF r_salesordertp
ENTITY salesorderitem
UPDATE
FIELDS ( requestedquantity )
WITH VALUE #( ( requestedquantity = <ls_aggr_ic_so>-quantity
%key-salesorder = <ls_aggr_ic_so>-receivingreturnorder
%key-salesorderitem = <ls_aggr_ic_so>-receivingreturnitem ) )
" TODO: variable is assigned but never used (ABAP cleaner)
FAILED DATA(ls_failed_update)
" TODO: variable is assigned but never used (ABAP cleaner)
REPORTED DATA(ls_reported_update).
COMMIT ENTITIES
RESPONSE OF i_salesordertp
" TODO: variable is assigned but never used (ABAP cleaner)
FAILED DATA(ls_save_failed)
" TODO: variable is assigned but never used (ABAP cleaner)
REPORTED DATA(ls_save_reported).
ENDLOOP.
But unfortunately i am receiving the error "The command "COMMIT-ENTITIES" is not allowed in a BEHAVIOR class." when activating and i don´t get why.
Aren´t actions meant to be able to modify its entities objects? Is there any workaround someone can suggest?
Request clarification before answering.
you are allow to make change in action, but it doesn't mean you have to use COMMIT-ENTITIES to persist the change.
just remove it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
65 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.